From efe6d0b6569998a31ec16c6b20f16aabd5593a97 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Mon, 22 Nov 2021 22:15:57 -0800 Subject: [PATCH 1/2] Use latest JLS for parser --- src/main/java/org/cadixdev/mercury/Mercury.java | 2 +- .../cadixdev/mercury/remapper/RemapperVisitor.java | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) 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(); From ce461dddf7408e64642349abdc5d471772b2f04b Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Mon, 22 Nov 2021 22:21:27 -0800 Subject: [PATCH 2/2] Bump jdt to 3.27.0 --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)