aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.matcher/src
diff options
context:
space:
mode:
authorAlexander Kriegisch <Alexander@Kriegisch.name>2021-03-21 17:34:09 +0700
committerAlexander Kriegisch <Alexander@Kriegisch.name>2021-03-21 17:34:09 +0700
commitecb5320c7b61d72edbf4a440e4996171a9c8f7dd (patch)
tree2b5496ad42ca47d0f3c7e636f2130dbb4d8b6e2c /org.aspectj.matcher/src
parente4a2a5a5d274bc16bae3d1178789752dba043730 (diff)
downloadaspectj-ecb5320c7b61d72edbf4a440e4996171a9c8f7dd.tar.gz
aspectj-ecb5320c7b61d72edbf4a440e4996171a9c8f7dd.zip
Fix some deprecated Java and JUnit warnings by using newer API calls
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'org.aspectj.matcher/src')
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/SimpleAnnotationValue.java2
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateFactory.java8
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionWorld.java10
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/AbstractTrace.java4
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/TraceFactory.java4
-rw-r--r--org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/PatternsTestCase.java2
6 files changed, 19 insertions, 11 deletions
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/SimpleAnnotationValue.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/SimpleAnnotationValue.java
index 32e55f6b4..2fe37e2cb 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/SimpleAnnotationValue.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/SimpleAnnotationValue.java
@@ -84,7 +84,7 @@ public class SimpleAnnotationValue extends AnnotationValue {
case 'B': // byte
return Byte.toString(theByte);
case 'C': // char
- return new Character(theChar).toString();
+ return Character.toString(theChar);
case 'D': // double
return Double.toString(theDouble);
case 'F': // float
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateFactory.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateFactory.java
index 9edf23f8f..a56950261 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateFactory.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateFactory.java
@@ -69,7 +69,7 @@ public class ReflectionBasedReferenceTypeDelegateFactory {
ClassLoader usingClassLoader, World inWorld) {
try {
Class delegateClass = Class.forName("org.aspectj.weaver.reflect.Java15ReflectionBasedReferenceTypeDelegate");
- ReflectionBasedReferenceTypeDelegate ret = (ReflectionBasedReferenceTypeDelegate) delegateClass.newInstance();
+ ReflectionBasedReferenceTypeDelegate ret = (ReflectionBasedReferenceTypeDelegate) delegateClass.getDeclaredConstructor().newInstance();
ret.initialize(forReferenceType, forClass, usingClassLoader, inWorld);
return ret;
} catch (ClassNotFoundException cnfEx) {
@@ -81,6 +81,12 @@ public class ReflectionBasedReferenceTypeDelegateFactory {
} catch (IllegalAccessException illAccEx) {
throw new IllegalStateException("Attempted to create Java 1.5 reflection based delegate but IllegalAccessException: "
+ illAccEx + " occured");
+ } catch (NoSuchMethodException nsMethEx) {
+ throw new IllegalStateException("Attempted to create Java 1.5 reflection based delegate but NoSuchMethodException: "
+ + nsMethEx + " occured");
+ } catch (InvocationTargetException invTargEx) {
+ throw new IllegalStateException("Attempted to create Java 1.5 reflection based delegate but InvocationTargetException: "
+ + invTargEx + " occured");
}
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionWorld.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionWorld.java
index e3e19e64b..464aba367 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionWorld.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionWorld.java
@@ -8,6 +8,7 @@
* ******************************************************************/
package org.aspectj.weaver.reflect;
+import java.lang.reflect.InvocationTargetException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -116,16 +117,17 @@ public class ReflectionWorld extends World implements IReflectionWorld {
AnnotationFinder annotationFinder = null;
try {
Class<?> java15AnnotationFinder = Class.forName("org.aspectj.weaver.reflect.Java15AnnotationFinder");
- annotationFinder = (AnnotationFinder) java15AnnotationFinder.newInstance();
+ annotationFinder = (AnnotationFinder) java15AnnotationFinder.getDeclaredConstructor().newInstance();
annotationFinder.setClassLoader(loader);
annotationFinder.setWorld(world);
} catch (ClassNotFoundException ex) {
// must be on 1.4 or earlier
- } catch (IllegalAccessException ex) {
+ } catch (IllegalAccessException | InstantiationException | NoSuchMethodException ex) {
// not so good
throw new BCException("AspectJ internal error", ex);
- } catch (InstantiationException ex) {
- throw new BCException("AspectJ internal error", ex);
+ }
+ catch (InvocationTargetException e) {
+ e.printStackTrace();
}
return annotationFinder;
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/AbstractTrace.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/AbstractTrace.java
index fe2f86f54..bca1985e7 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/AbstractTrace.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/AbstractTrace.java
@@ -68,7 +68,7 @@ public abstract class AbstractTrace implements Trace {
@Override
public void exit (String methodName, int i) {
- exit(methodName,new Integer(i));
+ exit(methodName, Integer.valueOf(i));
}
@Override
@@ -210,4 +210,4 @@ public abstract class AbstractTrace implements Trace {
return args;
}
-} \ No newline at end of file
+}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/TraceFactory.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/TraceFactory.java
index 3fc92f5b4..8190d67a3 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/TraceFactory.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/TraceFactory.java
@@ -45,7 +45,7 @@ public abstract class TraceFactory {
}
else {
Class factoryClass = Class.forName(factoryName);
- instance = (TraceFactory)factoryClass.newInstance();
+ instance = (TraceFactory)factoryClass.getDeclaredConstructor().newInstance();
}
}
catch (Throwable th) {
@@ -58,7 +58,7 @@ public abstract class TraceFactory {
if (instance == null) try {
{
Class factoryClass = Class.forName("org.aspectj.weaver.tools.Jdk14TraceFactory");
- instance = (TraceFactory)factoryClass.newInstance();
+ instance = (TraceFactory)factoryClass.getDeclaredConstructor().newInstance();
}
}
catch (Throwable th) {
diff --git a/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/PatternsTestCase.java b/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/PatternsTestCase.java
index 62a3c0566..82c1dc35c 100644
--- a/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/PatternsTestCase.java
+++ b/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/PatternsTestCase.java
@@ -24,7 +24,7 @@ public abstract class PatternsTestCase extends TestCase {
public URLClassLoader getClassLoaderForFile(File f) {
try {
- URLClassLoader ucl = new URLClassLoader(new URL[] { f.toURL() }, this.getClass().getClassLoader());
+ URLClassLoader ucl = new URLClassLoader(new URL[] { f.toURI().toURL() }, this.getClass().getClassLoader());
return ucl;
} catch (MalformedURLException mue) {
throw new RuntimeException(mue);