diff options
author | Andrey Turbanov <turbanoff@gmail.com> | 2022-04-13 13:51:39 +0300 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2022-04-15 11:00:33 +0700 |
commit | 2091b6d1ded90bfeb29f8d74bd17f05ec8fc983d (patch) | |
tree | 4afc936dbc982b72b5dadddafc8360f6c4436be0 /org.aspectj.ajdt.core | |
parent | 047a93c24f4eef3b2ebf254be9332d4340adbd04 (diff) | |
download | aspectj-2091b6d1ded90bfeb29f8d74bd17f05ec8fc983d.tar.gz aspectj-2091b6d1ded90bfeb29f8d74bd17f05ec8fc983d.zip |
Reduce 'Object' class usage
Diffstat (limited to 'org.aspectj.ajdt.core')
8 files changed, 16 insertions, 25 deletions
diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java index b9bd7db86..6542ac828 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java @@ -68,6 +68,7 @@ import org.aspectj.weaver.bcel.BcelAnnotation; import org.aspectj.weaver.bcel.BcelObjectType; import org.aspectj.weaver.bcel.FakeAnnotation; import org.aspectj.weaver.bcel.LazyClassGen; +import org.aspectj.weaver.patterns.Declare; import org.aspectj.weaver.patterns.DeclareAnnotation; import org.aspectj.weaver.patterns.DeclareParents; @@ -757,7 +758,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC } } - List<Object> forRemoval = new ArrayList<>(); + List<Declare> forRemoval = new ArrayList<>(); // now lets loop over and over until we have done all we can while ((anyNewAnnotations || anyNewParents) && (!decpToRepeat.isEmpty() || !decaToRepeat.isEmpty())) { anyNewParents = anyNewAnnotations = false; diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java index e58810f91..9604bab9b 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java @@ -489,7 +489,7 @@ public class AjProblemReporter extends ProblemReporter { AspectDeclaration ad = (AspectDeclaration) typeDecl.enclosingType; if (ad.concreteName != null) { List<Declare> declares = ad.concreteName.declares; - for (Object dec : declares) { + for (Declare dec : declares) { if (dec instanceof DeclareParents) { DeclareParents decp = (DeclareParents) dec; TypePattern[] newparents = decp.getParents().getTypePatterns(); diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java index 4c319d549..3e526002e 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java @@ -536,9 +536,8 @@ public class AjBuildConfig implements CompilerConfigurationChangeFlags { setMakeReflectable(global.isMakeReflectable()); } - @SuppressWarnings({ "rawtypes", "unchecked" }) - void join(Collection local, Collection global) { - for (Object next : global) { + <T> void join(Collection<T> local, Collection<T> global) { + for (T next : global) { if (!local.contains(next)) { local.add(next); } diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java index 941b30105..4f45959df 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java @@ -678,14 +678,13 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour } } - private ByteArrayOutputStream getOutxmlContents(List aspectNames) { + private ByteArrayOutputStream getOutxmlContents(List<String> aspectNames) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(baos); ps.println("<aspectj>"); ps.println("<aspects>"); if (aspectNames != null) { - for (Object aspectName : aspectNames) { - String name = (String) aspectName; + for (String name : aspectNames) { ps.println("<aspect name=\"" + name + "\"/>"); } } @@ -719,9 +718,8 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour } outputDirsToAspects.put(outputDir, aspectNames); } else { - List outputDirs = buildConfig.getCompilationResultDestinationManager().getAllOutputLocations(); - for (Object dir : outputDirs) { - File outputDir = (File) dir; + List<File> outputDirs = buildConfig.getCompilationResultDestinationManager().getAllOutputLocations(); + for (File outputDir : outputDirs) { outputDirsToAspects.put(outputDir, new ArrayList<>()); } if (aspectNamesToFileNames != null) { diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java index bd9842fca..95368d4bf 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java @@ -152,7 +152,7 @@ public class AjCompilerOptions extends CompilerOptions { @Override public void set(Map<String,String> optionsMap) { super.set(optionsMap); - Object optionValue; + String optionValue; if ((optionValue = optionsMap.get(OPTION_ReportUnusedPrivateMember)) != null) { updateSeverity(UnusedPrivateMember, optionValue); } diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjState.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjState.java index a354e0d92..358b71f91 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjState.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjState.java @@ -974,7 +974,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe * @param outputLocs the output locations that should be ignored if they occur on the paths being compared * @return true if a change is detected that requires a full build */ - private boolean changedAndNeedsFullBuild(List oldPath, List newPath, boolean checkClassFiles, List<File> outputLocs, + private boolean changedAndNeedsFullBuild(List<File> oldPath, List<File> newPath, boolean checkClassFiles, List<File> outputLocs, Set<String> alreadyAnalysedPaths, int pathid) { if (oldPath.size() != newPath.size()) { return true; @@ -983,13 +983,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe if (!oldPath.get(i).equals(newPath.get(i))) { return true; } - Object o = oldPath.get(i); // String on classpath, File on other paths - File f = null; - if (o instanceof String) { - f = new File((String) o); - } else { - f = (File) o; - } + File f = oldPath.get(i); if (f.exists() && !f.isDirectory() && (f.lastModified() >= lastSuccessfulBuildTime)) { return true; } diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/EmacsStructureModelManager.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/EmacsStructureModelManager.java index 2de9f358a..41a6663fb 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/EmacsStructureModelManager.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/EmacsStructureModelManager.java @@ -42,8 +42,8 @@ public class EmacsStructureModelManager { try { // Set fileSet = StructureModelManager.INSTANCE.getStructureModel().getFileMap().entrySet(); Set<Map.Entry<String, IProgramElement>> fileSet = model.getHierarchy().getFileMapEntrySet(); - for (Object o : fileSet) { - IProgramElement peNode = (IProgramElement) ((Map.Entry) o).getValue(); + for (Map.Entry<String, IProgramElement> o : fileSet) { + IProgramElement peNode = o.getValue(); dumpStructureToFile(peNode); } } catch (IOException ioe) { diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/org/eclipse/jdt/core/dom/AjNaiveASTFlattener.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/org/eclipse/jdt/core/dom/AjNaiveASTFlattener.java index dd5511fc9..6c465dd5b 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/org/eclipse/jdt/core/dom/AjNaiveASTFlattener.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/org/eclipse/jdt/core/dom/AjNaiveASTFlattener.java @@ -83,9 +83,8 @@ public class AjNaiveASTFlattener extends AjASTVisitor { * @param ext the list of modifier and annotation nodes * (element type: <code>IExtendedModifiers</code>) */ - void printModifiers(List ext) { - for (Object o : ext) { - ASTNode p = (ASTNode) o; + void printModifiers(List<ASTNode> ext) { + for (ASTNode p : ext) { p.accept(this); this.buffer.append(" ");//$NON-NLS-1$ } |