From dbbd9076b78a1e77a4a210631970acc15359d38d Mon Sep 17 00:00:00 2001 From: Danny van Bruggen Date: Wed, 1 May 2019 22:07:55 +0200 Subject: [PATCH] "typename" fits the purpose better than "classname" - it is also used in the JLS --- .../javaparser/ast/expr/SuperExprTest.java | 4 +- .../javaparser/ast/expr/ThisExprTest.java | 4 +- .../github/javaparser/ast/expr/SuperExpr.java | 46 +++++++++---------- .../github/javaparser/ast/expr/ThisExpr.java | 46 +++++++++---------- .../javaparser/ast/visitor/CloneVisitor.java | 4 +- .../javaparser/ast/visitor/EqualsVisitor.java | 4 +- .../visitor/GenericListVisitorAdapter.java | 8 ++-- .../ast/visitor/GenericVisitorAdapter.java | 8 ++-- .../ast/visitor/HashCodeVisitor.java | 4 +- .../ast/visitor/ModifierVisitor.java | 8 ++-- .../ast/visitor/NoCommentEqualsVisitor.java | 4 +- .../ast/visitor/NoCommentHashCodeVisitor.java | 4 +- .../ast/visitor/VoidVisitorAdapter.java | 4 +- .../printer/PrettyPrintVisitor.java | 8 ++-- .../javaparsermodel/JavaParserFacade.java | 4 +- .../javaparsermodel/TypeExtractor.java | 4 +- .../resolution/naming/NameLogic.java | 8 ++-- 17 files changed, 84 insertions(+), 88 deletions(-) diff --git a/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/SuperExprTest.java b/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/SuperExprTest.java index 7322de57fa..a44390140f 100644 --- a/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/SuperExprTest.java +++ b/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/SuperExprTest.java @@ -17,7 +17,7 @@ void justSuper() { void singleScopeSuper() { Expression expr = parseExpression("A.super"); - Name className = expr.asSuperExpr().getClassName().get(); + Name className = expr.asSuperExpr().getTypeName().get(); assertEquals("A", className.asString()); } @@ -26,7 +26,7 @@ void singleScopeSuper() { void multiScopeSuper() { Expression expr = parseExpression("a.B.super"); - Name className = expr.asSuperExpr().getClassName().get(); + Name className = expr.asSuperExpr().getTypeName().get(); assertEquals("a.B", className.asString()); } diff --git a/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/ThisExprTest.java b/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/ThisExprTest.java index 7d97bd3921..d6b32f33d7 100644 --- a/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/ThisExprTest.java +++ b/javaparser-core-testing/src/test/java/com/github/javaparser/ast/expr/ThisExprTest.java @@ -18,7 +18,7 @@ void justThis() { void singleScopeThis() { Expression expr = parseExpression("A.this"); - Name className = expr.asThisExpr().getClassName().get(); + Name className = expr.asThisExpr().getTypeName().get(); assertEquals("A", className.asString()); } @@ -27,7 +27,7 @@ void singleScopeThis() { void multiScopeThis() { Expression expr = parseExpression("a.B.this"); - Name className = expr.asThisExpr().getClassName().get(); + Name className = expr.asThisExpr().getTypeName().get(); assertEquals("a.B", className.asString()); } diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/SuperExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/SuperExpr.java index 47ad045a18..9a22aae841 100644 --- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/SuperExpr.java +++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/SuperExpr.java @@ -37,11 +37,9 @@ /** * An occurrence of the "super" keyword.
* World.super.greet() is a MethodCallExpr of method name greet, - * and scope "World.super" which is a SuperExpr with classExpr "World".
+ * and scope "World.super" which is a SuperExpr with typeName "World".
* super.name is a FieldAccessExpr of field greet, and a SuperExpr as its scope. - * This SuperExpr has no classExpr. - *
If classExpr is a single identifier (a.this) then it is of type NameExpr. - * If classExpr has multiple identifiers (a.b.c.this) then it is of type FieldAccessExpr. + * This SuperExpr has no typeName. * * @author Julio Vilmar Gesser * @see com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt @@ -50,24 +48,24 @@ public class SuperExpr extends Expression { @OptionalProperty - private Name className; + private Name typeName; public SuperExpr() { this(null, null); } @AllFieldsConstructor - public SuperExpr(final Name className) { - this(null, className); + public SuperExpr(final Name typeName) { + this(null, typeName); } /** * This constructor is used by the parser and is considered private. */ @Generated("com.github.javaparser.generator.core.node.MainConstructorGenerator") - public SuperExpr(TokenRange tokenRange, Name className) { + public SuperExpr(TokenRange tokenRange, Name typeName) { super(tokenRange); - setClassName(className); + setTypeName(typeName); customInitialization(); } @@ -84,20 +82,20 @@ public void accept(final VoidVisitor v, final A arg) { } @Generated("com.github.javaparser.generator.core.node.PropertyGenerator") - public Optional getClassName() { - return Optional.ofNullable(className); + public Optional getTypeName() { + return Optional.ofNullable(typeName); } @Generated("com.github.javaparser.generator.core.node.PropertyGenerator") - public SuperExpr setClassName(final Name className) { - if (className == this.className) { + public SuperExpr setTypeName(final Name typeName) { + if (typeName == this.typeName) { return (SuperExpr) this; } - notifyPropertyChange(ObservableProperty.CLASS_NAME, this.className, className); - if (this.className != null) - this.className.setParentNode(null); - this.className = className; - setAsParentNodeOf(className); + notifyPropertyChange(ObservableProperty.CLASS_NAME, this.typeName, typeName); + if (this.typeName != null) + this.typeName.setParentNode(null); + this.typeName = typeName; + setAsParentNodeOf(typeName); return this; } @@ -106,8 +104,8 @@ public SuperExpr setClassName(final Name className) { public boolean remove(Node node) { if (node == null) return false; - if (className != null) { - if (node == className) { + if (typeName != null) { + if (node == typeName) { removeClassName(); return true; } @@ -152,7 +150,7 @@ public Optional toSuperExpr() { @Generated("com.github.javaparser.generator.core.node.RemoveMethodGenerator") public SuperExpr removeClassName() { - return setClassName((Name) null); + return setTypeName((Name) null); } @Override @@ -160,9 +158,9 @@ public SuperExpr removeClassName() { public boolean replace(Node node, Node replacementNode) { if (node == null) return false; - if (className != null) { - if (node == className) { - setClassName((Name) replacementNode); + if (typeName != null) { + if (node == typeName) { + setTypeName((Name) replacementNode); return true; } } diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ThisExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ThisExpr.java index 2d56b6c25b..3f23b101a9 100644 --- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ThisExpr.java +++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ThisExpr.java @@ -39,11 +39,9 @@ /** * An occurrence of the "this" keyword.
* World.this.greet() is a MethodCallExpr of method name greet, - * and scope "World.this" which is a ThisExpr with classExpr "World".
+ * and scope "World.this" which is a ThisExpr with typeName "World".
* this.name is a FieldAccessExpr of field greet, and a ThisExpr as its scope. - * This ThisExpr has no classExpr. - *
If classExpr is a single identifier (a.this) then it is of type NameExpr. - * If classExpr has multiple identifiers (a.b.c.this) then it is of type FieldAccessExpr. + * This ThisExpr has no typeName. * * @author Julio Vilmar Gesser * @see com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt @@ -52,24 +50,24 @@ public class ThisExpr extends Expression implements Resolvable { @OptionalProperty - private Name className; + private Name typeName; public ThisExpr() { this(null, null); } @AllFieldsConstructor - public ThisExpr(final Name className) { - this(null, className); + public ThisExpr(final Name typeName) { + this(null, typeName); } /** * This constructor is used by the parser and is considered private. */ @Generated("com.github.javaparser.generator.core.node.MainConstructorGenerator") - public ThisExpr(TokenRange tokenRange, Name className) { + public ThisExpr(TokenRange tokenRange, Name typeName) { super(tokenRange); - setClassName(className); + setTypeName(typeName); customInitialization(); } @@ -86,20 +84,20 @@ public
void accept(final VoidVisitor v, final A arg) { } @Generated("com.github.javaparser.generator.core.node.PropertyGenerator") - public Optional getClassName() { - return Optional.ofNullable(className); + public Optional getTypeName() { + return Optional.ofNullable(typeName); } @Generated("com.github.javaparser.generator.core.node.PropertyGenerator") - public ThisExpr setClassName(final Name className) { - if (className == this.className) { + public ThisExpr setTypeName(final Name typeName) { + if (typeName == this.typeName) { return (ThisExpr) this; } - notifyPropertyChange(ObservableProperty.CLASS_NAME, this.className, className); - if (this.className != null) - this.className.setParentNode(null); - this.className = className; - setAsParentNodeOf(className); + notifyPropertyChange(ObservableProperty.CLASS_NAME, this.typeName, typeName); + if (this.typeName != null) + this.typeName.setParentNode(null); + this.typeName = typeName; + setAsParentNodeOf(typeName); return this; } @@ -108,8 +106,8 @@ public ThisExpr setClassName(final Name className) { public boolean remove(Node node) { if (node == null) return false; - if (className != null) { - if (node == className) { + if (typeName != null) { + if (node == typeName) { removeClassName(); return true; } @@ -119,7 +117,7 @@ public boolean remove(Node node) { @Generated("com.github.javaparser.generator.core.node.RemoveMethodGenerator") public ThisExpr removeClassName() { - return setClassName((Name) null); + return setTypeName((Name) null); } @Override @@ -139,9 +137,9 @@ public ThisExprMetaModel getMetaModel() { public boolean replace(Node node, Node replacementNode) { if (node == null) return false; - if (className != null) { - if (node == className) { - setClassName((Name) replacementNode); + if (typeName != null) { + if (node == typeName) { + setTypeName((Name) replacementNode); return true; } } diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/CloneVisitor.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/CloneVisitor.java index b0cd4bd10f..43057a0d03 100644 --- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/CloneVisitor.java +++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/CloneVisitor.java @@ -598,7 +598,7 @@ public Visitable visit(final SimpleName n, final Object arg) { @Override public Visitable visit(final ThisExpr n, final Object arg) { - Name className = cloneNode(n.getClassName(), arg); + Name className = cloneNode(n.getTypeName(), arg); Comment comment = cloneNode(n.getComment(), arg); ThisExpr r = new ThisExpr(n.getTokenRange().orElse(null), className); r.setComment(comment); @@ -608,7 +608,7 @@ public Visitable visit(final ThisExpr n, final Object arg) { @Override public Visitable visit(final SuperExpr n, final Object arg) { - Name className = cloneNode(n.getClassName(), arg); + Name className = cloneNode(n.getTypeName(), arg); Comment comment = cloneNode(n.getComment(), arg); SuperExpr r = new SuperExpr(n.getTokenRange().orElse(null), className); r.setComment(comment); diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/EqualsVisitor.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/EqualsVisitor.java index 57538ed095..5bb26324f1 100644 --- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/EqualsVisitor.java +++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/EqualsVisitor.java @@ -792,7 +792,7 @@ public Boolean visit(final SimpleName n, final Visitable arg) { @Override public Boolean visit(final ThisExpr n, final Visitable arg) { final ThisExpr n2 = (ThisExpr) arg; - if (!nodeEquals(n.getClassName(), n2.getClassName())) + if (!nodeEquals(n.getTypeName(), n2.getTypeName())) return false; if (!nodeEquals(n.getComment(), n2.getComment())) return false; @@ -802,7 +802,7 @@ public Boolean visit(final ThisExpr n, final Visitable arg) { @Override public Boolean visit(final SuperExpr n, final Visitable arg) { final SuperExpr n2 = (SuperExpr) arg; - if (!nodeEquals(n.getClassName(), n2.getClassName())) + if (!nodeEquals(n.getTypeName(), n2.getTypeName())) return false; if (!nodeEquals(n.getComment(), n2.getComment())) return false; diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericListVisitorAdapter.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericListVisitorAdapter.java index 8dc08d8deb..15e7d97c84 100644 --- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericListVisitorAdapter.java +++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericListVisitorAdapter.java @@ -1471,8 +1471,8 @@ public List visit(final StringLiteralExpr n, final A arg) { public List visit(final SuperExpr n, final A arg) { List result = new ArrayList<>(); List tmp; - if (n.getClassName().isPresent()) { - tmp = n.getClassName().get().accept(this, arg); + if (n.getTypeName().isPresent()) { + tmp = n.getTypeName().get().accept(this, arg); if (tmp != null) result.addAll(tmp); } @@ -1550,8 +1550,8 @@ public List visit(final SynchronizedStmt n, final A arg) { public List visit(final ThisExpr n, final A arg) { List result = new ArrayList<>(); List tmp; - if (n.getClassName().isPresent()) { - tmp = n.getClassName().get().accept(this, arg); + if (n.getTypeName().isPresent()) { + tmp = n.getTypeName().get().accept(this, arg); if (tmp != null) result.addAll(tmp); } diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericVisitorAdapter.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericVisitorAdapter.java index 132e8b2e93..529100c313 100644 --- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericVisitorAdapter.java +++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericVisitorAdapter.java @@ -1392,8 +1392,8 @@ public R visit(final StringLiteralExpr n, final A arg) { @Override public R visit(final SuperExpr n, final A arg) { R result; - if (n.getClassName().isPresent()) { - result = n.getClassName().get().accept(this, arg); + if (n.getTypeName().isPresent()) { + result = n.getTypeName().get().accept(this, arg); if (result != null) return result; } @@ -1471,8 +1471,8 @@ public R visit(final SynchronizedStmt n, final A arg) { @Override public R visit(final ThisExpr n, final A arg) { R result; - if (n.getClassName().isPresent()) { - result = n.getClassName().get().accept(this, arg); + if (n.getTypeName().isPresent()) { + result = n.getTypeName().get().accept(this, arg); if (result != null) return result; } diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/HashCodeVisitor.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/HashCodeVisitor.java index 998ebd4dc6..d1f258a533 100644 --- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/HashCodeVisitor.java +++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/HashCodeVisitor.java @@ -315,7 +315,7 @@ public Integer visit(final StringLiteralExpr n, final Void arg) { } public Integer visit(final SuperExpr n, final Void arg) { - return (n.getClassName().isPresent() ? n.getClassName().get().accept(this, arg) : 0) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0); + return (n.getTypeName().isPresent() ? n.getTypeName().get().accept(this, arg) : 0) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0); } public Integer visit(final SwitchEntry n, final Void arg) { @@ -331,7 +331,7 @@ public Integer visit(final SynchronizedStmt n, final Void arg) { } public Integer visit(final ThisExpr n, final Void arg) { - return (n.getClassName().isPresent() ? n.getClassName().get().accept(this, arg) : 0) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0); + return (n.getTypeName().isPresent() ? n.getTypeName().get().accept(this, arg) : 0) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0); } public Integer visit(final ThrowStmt n, final Void arg) { diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/ModifierVisitor.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/ModifierVisitor.java index 931e782ceb..d2d03568f8 100644 --- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/ModifierVisitor.java +++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/ModifierVisitor.java @@ -830,9 +830,9 @@ public Visitable visit(final StringLiteralExpr n, final A arg) { @Override public Visitable visit(final SuperExpr n, final A arg) { - Name className = n.getClassName().map(s -> (Name) s.accept(this, arg)).orElse(null); + Name className = n.getTypeName().map(s -> (Name) s.accept(this, arg)).orElse(null); Comment comment = n.getComment().map(s -> (Comment) s.accept(this, arg)).orElse(null); - n.setClassName(className); + n.setTypeName(className); n.setComment(comment); return n; } @@ -876,9 +876,9 @@ public Visitable visit(final SynchronizedStmt n, final A arg) { @Override public Visitable visit(final ThisExpr n, final A arg) { - Name className = n.getClassName().map(s -> (Name) s.accept(this, arg)).orElse(null); + Name className = n.getTypeName().map(s -> (Name) s.accept(this, arg)).orElse(null); Comment comment = n.getComment().map(s -> (Comment) s.accept(this, arg)).orElse(null); - n.setClassName(className); + n.setTypeName(className); n.setComment(comment); return n; } diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/NoCommentEqualsVisitor.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/NoCommentEqualsVisitor.java index d7ea8446e4..823a63e84c 100644 --- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/NoCommentEqualsVisitor.java +++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/NoCommentEqualsVisitor.java @@ -643,7 +643,7 @@ public Boolean visit(final SimpleName n, final Visitable arg) { @Override public Boolean visit(final ThisExpr n, final Visitable arg) { final ThisExpr n2 = (ThisExpr) arg; - if (!nodeEquals(n.getClassName(), n2.getClassName())) + if (!nodeEquals(n.getTypeName(), n2.getTypeName())) return false; return true; } @@ -651,7 +651,7 @@ public Boolean visit(final ThisExpr n, final Visitable arg) { @Override public Boolean visit(final SuperExpr n, final Visitable arg) { final SuperExpr n2 = (SuperExpr) arg; - if (!nodeEquals(n.getClassName(), n2.getClassName())) + if (!nodeEquals(n.getTypeName(), n2.getTypeName())) return false; return true; } diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/NoCommentHashCodeVisitor.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/NoCommentHashCodeVisitor.java index 831edd3a29..7b2c661b61 100644 --- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/NoCommentHashCodeVisitor.java +++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/NoCommentHashCodeVisitor.java @@ -307,7 +307,7 @@ public Integer visit(final StringLiteralExpr n, final Void arg) { } public Integer visit(final SuperExpr n, final Void arg) { - return (n.getClassName().isPresent() ? n.getClassName().get().accept(this, arg) : 0); + return (n.getTypeName().isPresent() ? n.getTypeName().get().accept(this, arg) : 0); } public Integer visit(final SwitchEntry n, final Void arg) { @@ -323,7 +323,7 @@ public Integer visit(final SynchronizedStmt n, final Void arg) { } public Integer visit(final ThisExpr n, final Void arg) { - return (n.getClassName().isPresent() ? n.getClassName().get().accept(this, arg) : 0); + return (n.getTypeName().isPresent() ? n.getTypeName().get().accept(this, arg) : 0); } public Integer visit(final ThrowStmt n, final Void arg) { diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/VoidVisitorAdapter.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/VoidVisitorAdapter.java index cd661f3ead..193ab50def 100644 --- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/VoidVisitorAdapter.java +++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/VoidVisitorAdapter.java @@ -488,7 +488,7 @@ public void visit(final StringLiteralExpr n, final A arg) { @Override public void visit(final SuperExpr n, final A arg) { - n.getClassName().ifPresent(l -> l.accept(this, arg)); + n.getTypeName().ifPresent(l -> l.accept(this, arg)); n.getComment().ifPresent(l -> l.accept(this, arg)); } @@ -515,7 +515,7 @@ public void visit(final SynchronizedStmt n, final A arg) { @Override public void visit(final ThisExpr n, final A arg) { - n.getClassName().ifPresent(l -> l.accept(this, arg)); + n.getTypeName().ifPresent(l -> l.accept(this, arg)); n.getComment().ifPresent(l -> l.accept(this, arg)); } diff --git a/javaparser-core/src/main/java/com/github/javaparser/printer/PrettyPrintVisitor.java b/javaparser-core/src/main/java/com/github/javaparser/printer/PrettyPrintVisitor.java index ceccbe3b97..3f38f0e6c0 100644 --- a/javaparser-core/src/main/java/com/github/javaparser/printer/PrettyPrintVisitor.java +++ b/javaparser-core/src/main/java/com/github/javaparser/printer/PrettyPrintVisitor.java @@ -709,8 +709,8 @@ public void visit(final NullLiteralExpr n, final Void arg) { @Override public void visit(final ThisExpr n, final Void arg) { printComment(n.getComment(), arg); - if (n.getClassName().isPresent()) { - n.getClassName().get().accept(this, arg); + if (n.getTypeName().isPresent()) { + n.getTypeName().get().accept(this, arg); printer.print("."); } printer.print("this"); @@ -719,8 +719,8 @@ public void visit(final ThisExpr n, final Void arg) { @Override public void visit(final SuperExpr n, final Void arg) { printComment(n.getComment(), arg); - if (n.getClassName().isPresent()) { - n.getClassName().get().accept(this, arg); + if (n.getTypeName().isPresent()) { + n.getTypeName().get().accept(this, arg); printer.print("."); } printer.print("super"); diff --git a/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/javaparsermodel/JavaParserFacade.java b/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/javaparsermodel/JavaParserFacade.java index 07b585f7ef..5780a8b656 100644 --- a/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/javaparsermodel/JavaParserFacade.java +++ b/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/javaparsermodel/JavaParserFacade.java @@ -168,9 +168,9 @@ public SymbolReference solve(ExplicitConstructor public SymbolReference solve(ThisExpr node) { // If 'this' is prefixed by a class eg. MyClass.this - if (node.getClassName().isPresent()) { + if (node.getTypeName().isPresent()) { // Get the class name - String className = node.getClassName().get().asString(); + String className = node.getTypeName().get().asString(); // Attempt to resolve using a typeSolver SymbolReference clazz = typeSolver.tryToSolveType(className); if (clazz.isSolved()) { diff --git a/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/javaparsermodel/TypeExtractor.java b/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/javaparsermodel/TypeExtractor.java index 1cd2e1237d..908a3d025f 100644 --- a/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/javaparsermodel/TypeExtractor.java +++ b/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/javaparsermodel/TypeExtractor.java @@ -290,9 +290,9 @@ public ResolvedType visit(ObjectCreationExpr node, Boolean solveLambdas) { @Override public ResolvedType visit(ThisExpr node, Boolean solveLambdas) { // If 'this' is prefixed by a class eg. MyClass.this - if (node.getClassName().isPresent()) { + if (node.getTypeName().isPresent()) { // Get the class name - String className = node.getClassName().get().asString(); + String className = node.getTypeName().get().asString(); // Attempt to resolve using a typeSolver SymbolReference clazz = typeSolver.tryToSolveType(className); if (clazz.isSolved()) { diff --git a/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/naming/NameLogic.java b/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/naming/NameLogic.java index f5470670e7..e6701b9e06 100644 --- a/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/naming/NameLogic.java +++ b/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/naming/NameLogic.java @@ -215,10 +215,10 @@ public static NameRole classifyRole(Node name) { if (whenParentIs(ClassExpr.class, name, (p, c) -> p.getType() == c)) { return NameRole.REFERENCE; } - if (whenParentIs(ThisExpr.class, name, (p, c) -> p.getClassName().isPresent() && p.getClassName().get() == c)) { + if (whenParentIs(ThisExpr.class, name, (p, c) -> p.getTypeName().isPresent() && p.getTypeName().get() == c)) { return NameRole.REFERENCE; } - if (whenParentIs(SuperExpr.class, name, (p, c) -> p.getClassName().isPresent() && p.getClassName().get() == c)) { + if (whenParentIs(SuperExpr.class, name, (p, c) -> p.getTypeName().isPresent() && p.getTypeName().get() == c)) { return NameRole.REFERENCE; } if (whenParentIs(VariableDeclarator.class, name, (p, c) -> p.getName() == c)) { @@ -692,14 +692,14 @@ private static boolean isSyntacticallyATypeName(Node name) { // 8. To the left of .this in a qualified this expression (§15.8.4) if (whenParentIs(ThisExpr.class, name, (ne, c2) -> - ne.getClassName().isPresent() && ne.getClassName().get() == c2)) { + ne.getTypeName().isPresent() && ne.getTypeName().get() == c2)) { return true; } // 9. To the left of .super in a qualified superclass field access expression (§15.11.2) if (whenParentIs(SuperExpr.class, name, (ne, c2) -> - ne.getClassName().isPresent() && ne.getClassName().get() == c2)) { + ne.getTypeName().isPresent() && ne.getTypeName().get() == c2)) { return true; }