Skip to content

Commit 98491e1

Browse files
authored
Fix viewarea gaining an import after applying range mappings (#58)
* Fix `<expression>.new <type>()` generating an unnecessary import * Fix gradle build error and update modlauncher to version with ManifestEntryVerifier reflection fixed * Use fixed versions
1 parent 361b183 commit 98491e1

2 files changed

Lines changed: 36 additions & 11 deletions

File tree

build.gradle

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,29 @@ dependencies {
5050

5151
// necessary eclipse AST stuff
5252
implementation 'org.eclipse.jdt:org.eclipse.jdt.core:3.29.0'
53+
implementation('org.eclipse.platform:org.eclipse.core.runtime') {
54+
version {
55+
strictly '3.26.0'
56+
}
57+
}
58+
implementation('org.eclipse.platform:org.eclipse.core.resources') {
59+
version {
60+
strictly '3.18.0'
61+
}
62+
}
63+
implementation('org.eclipse.platform:org.eclipse.core.jobs') {
64+
version {
65+
strictly '3.13.100'
66+
}
67+
}
68+
implementation('org.eclipse.platform:org.eclipse.core.contenttype') {
69+
version {
70+
strictly '3.8.200'
71+
}
72+
}
5373

5474
//We use this to patch the JDT at runtime
55-
implementation 'cpw.mods:modlauncher:8.0.9'
75+
implementation 'cpw.mods:modlauncher:8.1.3'
5676

5777
// ModLauncher has this on runtime scope
5878
implementation 'com.google.code.findbugs:jsr305:3.0.2'

src/main/java/net/minecraftforge/srg2source/extract/SymbolReferenceWalker.java

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -579,26 +579,31 @@ private boolean process(PackageDeclaration node) {
579579
*
580580
* This is what causes ViewFrustum to add the extra ChunkRenderDispatcher.ChunkRender import:
581581
* `renderChunkFactory.new ChunkRender();`
582-
* Problem is.... we have no idea how to get the subtype's root name object... Will need to look into this more
583582
*/
584583
private boolean process(ClassInstanceCreation node) {
585-
return true;
586-
/*
587-
if (node.getExpression() == null)
584+
if (node.getExpression() == null || node.getAST().apiLevel() >= JLS3 && !node.getType().isSimpleType() || node.getAST().apiLevel() <= JLS2 && !node.getName().isSimpleName())
588585
return true;
589586

590-
if (node.toString().contains("ChunkRender()"))
591-
System.currentTimeMillis();
592-
if (node.getAST().apiLevel() == JLS2) {
593-
acceptChild(node.getName());
587+
Name name = null;
588+
acceptChild(node.getExpression());
589+
if (node.getAST().apiLevel() <= JLS2) {
590+
name = node.getName();
594591
} else if (node.getAST().apiLevel() >= JLS3) {
595592
acceptChildren(node.typeArguments());
596-
acceptChild(node.getType();
593+
name = ((SimpleType) node.getType()).getName();
594+
}
595+
596+
IBinding binding = name.resolveBinding();
597+
if (binding.getKind() != IBinding.TYPE) {
598+
error(node, "Non type binding when constructing an instance: " + binding.getName());
599+
return false;
597600
}
601+
602+
String clsName = getInternalName((ITypeBinding) binding, name);
603+
builder.addClassReference(name.getStartPosition(), name.getLength(), name.toString(), clsName, true);
598604
acceptChildren(node.arguments());
599605
acceptChild(node.getAnonymousClassDeclaration());
600606
return false;
601-
*/
602607
}
603608

604609
/*

0 commit comments

Comments
 (0)