mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-13 12:15:00 +00:00
Replace getSimpleName() with getName()
This commit is contained in:
1 parent
e964c995ca
commit
4e359da7cc
2 files changed
+4
-11
No files matched your search
@@ -233,14 +233,7 @@ public class EclipseHandlerUtil {
|
||||
* @param typeRef A type reference to check.
|
||||
*/
|
||||
public static boolean typeMatches(Class<?> type, EclipseNode node, TypeReference typeRef) {
|
||||
if (typeRef == null || typeRef.getTypeName() == null || typeRef.getTypeName().length == 0) return false;
|
||||
String lastPartA = new String(typeRef.getTypeName()[typeRef.getTypeName().length -1]);
|
||||
String lastPartB = type.getSimpleName();
|
||||
if (!lastPartA.equals(lastPartB)) return false;
|
||||
String typeName = toQualifiedName(typeRef.getTypeName());
|
||||
|
||||
TypeResolver resolver = new TypeResolver(node.getImportList());
|
||||
return resolver.typeMatches(node, type.getName(), typeName);
|
||||
return typeMatches(type.getName(), node, typeRef);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -254,7 +247,7 @@ public class EclipseHandlerUtil {
|
||||
char[][] tn = typeRef == null ? null : typeRef.getTypeName();
|
||||
if (tn == null || tn.length == 0) return false;
|
||||
char[] lastPartA = tn[tn.length - 1];
|
||||
int lastIndex = type.lastIndexOf('.') + 1;
|
||||
int lastIndex = Math.max(type.lastIndexOf('.'), type.lastIndexOf('$')) + 1;
|
||||
if (lastPartA.length != type.length() - lastIndex) return false;
|
||||
for (int i = 0; i < lastPartA.length; i++) if (lastPartA[i] != type.charAt(i + lastIndex)) return false;
|
||||
String typeName = toQualifiedName(tn);
|
||||
|
||||
@@ -258,7 +258,7 @@ public class JavacAST extends AST<JavacAST, JavacNode, JCTree> {
|
||||
|
||||
if (typeUse == null) return null;
|
||||
|
||||
if (typeUse.getClass().getSimpleName().equals("JCAnnotatedType")) {
|
||||
if (typeUse.getClass().getName().equals("com.sun.tools.javac.tree.JCTree$JCAnnotatedType")) {
|
||||
initJcAnnotatedType(typeUse.getClass());
|
||||
Collection<?> anns = Permit.permissiveReadField(Collection.class, JCANNOTATEDTYPE_ANNOTATIONS, typeUse);
|
||||
JCExpression underlying = Permit.permissiveReadField(JCExpression.class, JCANNOTATEDTYPE_UNDERLYINGTYPE, typeUse);
|
||||
@@ -381,7 +381,7 @@ public class JavacAST extends AST<JavacAST, JavacNode, JCTree> {
|
||||
if (statement instanceof JCClassDecl) return buildType((JCClassDecl) statement);
|
||||
if (statement instanceof JCVariableDecl) return buildLocalVar((JCVariableDecl) statement, Kind.LOCAL);
|
||||
if (statement instanceof JCTry) return buildTry((JCTry) statement);
|
||||
if (statement.getClass().getSimpleName().equals("JCLambda")) return buildLambda(statement);
|
||||
if (statement.getClass().getName().equals("com.sun.tools.javac.tree.JCTree$JCLambda")) return buildLambda(statement);
|
||||
if (setAndGetAsHandled(statement)) return null;
|
||||
|
||||
return drill(statement);
|
||||
|
||||
Reference in new issue
Block a user