diff --git a/build.gradle.kts b/build.gradle.kts index 1f4d396..bf4d602 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -25,7 +25,7 @@ repositories { mavenCentral() } -val jdt = "org.eclipse.jdt:org.eclipse.jdt.core:3.25.0" +val jdt = "org.eclipse.jdt:org.eclipse.jdt.core:3.27.0" dependencies { api(jdt) diff --git a/src/main/java/org/cadixdev/mercury/Mercury.java b/src/main/java/org/cadixdev/mercury/Mercury.java index a6cdb80..c8f43d1 100644 --- a/src/main/java/org/cadixdev/mercury/Mercury.java +++ b/src/main/java/org/cadixdev/mercury/Mercury.java @@ -190,7 +190,7 @@ private void cleanup() { } private void run() throws Exception { - ASTParser parser = ASTParser.newParser(AST.JLS10); + ASTParser parser = ASTParser.newParser(AST.getJLSLatest()); // Set Java version Map options = JavaCore.getOptions(); diff --git a/src/main/java/org/cadixdev/mercury/remapper/RemapperVisitor.java b/src/main/java/org/cadixdev/mercury/remapper/RemapperVisitor.java index 3447e72..3faa43c 100644 --- a/src/main/java/org/cadixdev/mercury/remapper/RemapperVisitor.java +++ b/src/main/java/org/cadixdev/mercury/remapper/RemapperVisitor.java @@ -39,6 +39,7 @@ import org.eclipse.jdt.core.dom.PackageDeclaration; import org.eclipse.jdt.core.dom.QualifiedName; import org.eclipse.jdt.core.dom.QualifiedType; +import org.eclipse.jdt.core.dom.RecordDeclaration; import org.eclipse.jdt.core.dom.SimpleName; import org.eclipse.jdt.core.dom.SimpleType; import org.eclipse.jdt.core.dom.TagElement; @@ -428,6 +429,12 @@ public boolean visit(EnumDeclaration node) { return true; } + @Override + public boolean visit(RecordDeclaration node) { + pushImportContext(node.resolveBinding()); + return true; + } + @Override public boolean visit(TypeDeclaration node) { pushImportContext(node.resolveBinding()); @@ -449,6 +456,11 @@ public void endVisit(EnumDeclaration node) { this.importStack.pop(); } + @Override + public void endVisit(RecordDeclaration node) { + this.importStack.pop(); + } + @Override public void endVisit(TypeDeclaration node) { this.importStack.pop();