From 6f242e7545da863634d894f29fedc57930f8de1a Mon Sep 17 00:00:00 2001 From: Aosen Xiong Date: Sat, 1 Jun 2024 14:24:15 -0400 Subject: [PATCH] Use isEmpty for check --- .../java/pico/inference/PICOInferenceAnnotatedTypeFactory.java | 2 +- src/main/java/pico/inference/PICOVariableAnnotator.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/pico/inference/PICOInferenceAnnotatedTypeFactory.java b/src/main/java/pico/inference/PICOInferenceAnnotatedTypeFactory.java index c2eb390..ed172c5 100644 --- a/src/main/java/pico/inference/PICOInferenceAnnotatedTypeFactory.java +++ b/src/main/java/pico/inference/PICOInferenceAnnotatedTypeFactory.java @@ -115,7 +115,7 @@ public AnnotatedDeclaredType getSelfType(Tree tree) { AnnotatedDeclaredType type = getAnnotatedType(enclosingClass); MethodTree enclosingMethod = TreePathUtil.enclosingMethod(path); - if (enclosingClass.getSimpleName().length() != 0 && enclosingMethod != null) { + if (!enclosingClass.getSimpleName().isEmpty() && enclosingMethod != null) { AnnotatedTypeMirror.AnnotatedDeclaredType methodReceiver; if (TreeUtils.isConstructor(enclosingMethod)) { methodReceiver = diff --git a/src/main/java/pico/inference/PICOVariableAnnotator.java b/src/main/java/pico/inference/PICOVariableAnnotator.java index 81d93ff..e1b01da 100644 --- a/src/main/java/pico/inference/PICOVariableAnnotator.java +++ b/src/main/java/pico/inference/PICOVariableAnnotator.java @@ -197,7 +197,7 @@ public void storeElementType(Element element, AnnotatedTypeMirror atm) { // Copied from super implementation @Override protected boolean handleWasRawDeclaredTypes(AnnotatedDeclaredType adt) { - if (adt.isUnderlyingTypeRaw() && adt.getTypeArguments().size() != 0) { + if (adt.isUnderlyingTypeRaw() && !adt.getTypeArguments().isEmpty()) { // the type arguments should be wildcards AND if I get the real type of "tree" // it corresponds to the declaration of adt.getUnderlyingType Element declarationEle = adt.getUnderlyingType().asElement();