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();