This is an automated email from the ASF dual-hosted git repository. lkishalmi pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-netbeans.git
The following commit(s) were added to refs/heads/master by this push: new e1a1df8 [NETBEANS-2120] Placing synthetically generated classes in spi.java.hints into an accessible package. e1a1df8 is described below commit e1a1df8824bb5bf456fd98425f1ac8902cdffaaa Author: Jan Lahoda <jlah...@netbeans.org> AuthorDate: Sun Feb 17 08:37:48 2019 +0100 [NETBEANS-2120] Placing synthetically generated classes in spi.java.hints into an accessible package. --- .../modules/java/hints/spiimpl/JackpotTrees.java | 40 ++-------------------- .../modules/java/hints/spiimpl/Utilities.java | 7 ++-- 2 files changed, 7 insertions(+), 40 deletions(-) diff --git a/java/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/JackpotTrees.java b/java/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/JackpotTrees.java index dc1eeaf..cd3b91b 100644 --- a/java/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/JackpotTrees.java +++ b/java/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/JackpotTrees.java @@ -79,6 +79,7 @@ public class JackpotTrees { .method(ElementMatchers.named("accept").and(ElementMatchers.takesArguments(Visitor.class))).intercept(MethodCall.invoke(visitIdent).onArgument(0).withField("jcIdent")) .method(ElementMatchers.named("accept").and(ElementMatchers.takesArgument(0, TreeVisitor.class))).intercept(MethodCall.invoke(visitIdentifier).onArgument(0).withThis().withArgument(1)) .method(ElementMatchers.named("toString")).intercept(MethodCall.invoke(toString).onField("ident")) + .name(JackpotTrees.class.getCanonicalName() + "$" + clazz.getCanonicalName().replace('.', '$')) .make()) .getLoaded(); baseClass2Impl.put(clazz, fake); @@ -111,7 +112,7 @@ public class JackpotTrees { return clazz.cast(tree); } - throw new IllegalStateException(); + throw new IllegalStateException(Arrays.asList(fake.getDeclaredConstructors()).toString()); } catch (IllegalAccessException | IllegalArgumentException | IllegalStateException | InstantiationException | NoSuchFieldException | NoSuchMethodException | SecurityException | InvocationTargetException ex) { throw new IllegalStateException(ex); } @@ -252,43 +253,6 @@ public class JackpotTrees { } } - public static class CaseWildcard extends JCCase implements IdentifierTree { - - private final Name ident; - private final JCIdent jcIdent; - - public CaseWildcard(Context ctx, Name ident, JCIdent jcIdent) { - super(jcIdent, List.<JCStatement>nil()); - this.ident = ident; - this.jcIdent = jcIdent; - } - - public Name getName() { - return ident; - } - - @Override - public Kind getKind() { - return Kind.IDENTIFIER; - } - - @Override - public void accept(Visitor v) { - v.visitIdent(jcIdent); - } - - @Override - public <R, D> R accept(TreeVisitor<R, D> v, D d) { - return v.visitIdentifier(this, d); - } - - @Override - public String toString() { - return "case " + ident.toString(); - } - - } - public static class FakeBlock extends JCBlock { public FakeBlock(long flags, List<JCStatement> stats) { diff --git a/java/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/Utilities.java b/java/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/Utilities.java index cb8b8bd..8f5d9db 100644 --- a/java/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/Utilities.java +++ b/java/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/Utilities.java @@ -1466,7 +1466,9 @@ public class Utilities { nextToken(); } - return new JackpotTrees.CaseWildcard(ctx, name, F.at(pos).Ident(name)); + JCIdent identTree = F.at(pos).Ident(name); + + return JackpotTrees.createInstance(ctx, JCCase.class, name, identTree, new Class[] {JCExpression.class, com.sun.tools.javac.util.List.class}, new Object[] {identTree, com.sun.tools.javac.util.List.nil()}); } } } @@ -1496,7 +1498,8 @@ public class Utilities { } Class caseKind = Class.forName("com.sun.source.tree.CaseTree$CaseKind", false, JCCase.class.getClassLoader()); - return com.sun.tools.javac.util.List.of(JackpotTrees.createInstance(ctx, JCCase.class, name, make.Ident(name), new Class[] {caseKind, com.sun.tools.javac.util.List.class, com.sun.tools.javac.util.List.class, JCTree.class}, new Object[] {Enum.valueOf(caseKind, "STATEMENT"), com.sun.tools.javac.util.List.nil(), com.sun.tools.javac.util.List.nil(), null})); + JCIdent identTree = F.at(pos).Ident(name); + return com.sun.tools.javac.util.List.of(JackpotTrees.createInstance(ctx, JCCase.class, name, identTree, new Class[] {caseKind, com.sun.tools.javac.util.List.class, com.sun.tools.javac.util.List.class, JCTree.class}, new Object[] {Enum.valueOf(caseKind, "STATEMENT"), com.sun.tools.javac.util.List.of(identTree), com.sun.tools.javac.util.List.nil(), null})); } } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists