Index: vm/vmcore/src/kernel_classes/javasrc/java/lang/VMStart.java
===================================================================
--- vm/vmcore/src/kernel_classes/javasrc/java/lang/VMStart.java (revision 529804)
+++ vm/vmcore/src/kernel_classes/javasrc/java/lang/VMStart.java (working copy)
@@ -21,11 +21,6 @@
package java.lang;
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Modifier;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
import java.util.Properties;
import java.util.Enumeration;
Index: vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/Method.java
===================================================================
--- vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/Method.java (revision 529804)
+++ vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/Method.java (working copy)
@@ -98,14 +98,15 @@
/**
* @com.intel.drl.spec_ref
*/
+ @SuppressWarnings("unchecked")
public A getAnnotation(Class annotationClass) {
if(annotationClass == null) {
throw new NullPointerException();
}
- Annotation aa[] = data.getDeclaredAnnotations();
- for (int i = 0; i < aa.length; i++) {
- if(aa[i].annotationType() == annotationClass) {
- return (A) aa[i];
+ for (Annotation aa : data.getDeclaredAnnotations()) {
+ if(aa.annotationType() == annotationClass) {
+
+ return (A) aa;
}
}
return null;
@@ -679,6 +680,7 @@
/**
* initializes type parameters
*/
+ @SuppressWarnings("unchecked")
public synchronized void initTypeParameters() {
// So, here it can be only TypeVariable elements.
if (typeParameters == null) {
@@ -709,5 +711,4 @@
}
}
}
-
}
Index: vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/Field.java
===================================================================
--- vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/Field.java (revision 529804)
+++ vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/Field.java (working copy)
@@ -65,14 +65,14 @@
/**
* @com.intel.drl.spec_ref
*/
+ @SuppressWarnings("unchecked")
public T getAnnotation(Class annotationClass) {
if(annotationClass == null) {
throw new NullPointerException();
}
- Annotation aa[] = data.getAnnotations();
- for (int i = 0; i < aa.length; i++) {
- if(aa[i].annotationType() == annotationClass) {
- return (T) aa[i];
+ for (Annotation aa : data.getAnnotations()) {
+ if(aa.annotationType() == annotationClass) {
+ return (T) aa;
}
}
return null;
Index: vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/Constructor.java
===================================================================
--- vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/Constructor.java (revision 529804)
+++ vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/Constructor.java (working copy)
@@ -90,14 +90,14 @@
/**
* @com.intel.drl.spec_ref
*/
+ @SuppressWarnings("unchecked")
public A getAnnotation(Class annotationClass) {
if(annotationClass == null) {
throw new NullPointerException();
}
- Annotation aa[] = data.getDeclaredAnnotations();
- for (int i = 0; i < aa.length; i++) {
- if(aa[i].annotationType() == annotationClass) {
- return (A) aa[i];
+ for (Annotation a : data.getDeclaredAnnotations()) {
+ if (a.annotationType() == annotationClass) {
+ return (A) a; // warning here, but it's known its type is A
}
}
return null;
@@ -278,6 +278,7 @@
/**
* @com.intel.drl.spec_ref
*/
+ @SuppressWarnings("unchecked")
public T newInstance(Object... args) throws InstantiationException,
IllegalAccessException, IllegalArgumentException,
InvocationTargetException {
@@ -576,6 +577,7 @@
/**
* initializes type parameters
*/
+ @SuppressWarnings("unchecked")
public synchronized void initTypeParameters() {
//So, here it can be only TypeVariable elements.
if (typeParameters == null) {
Index: vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java
===================================================================
--- vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java (revision 529804)
+++ vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java (working copy)
@@ -50,7 +50,6 @@
import java.security.ProtectionDomain;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Map;
@@ -906,6 +905,7 @@
* @com.intel.drl.spec_ref
*
**/
+ @SuppressWarnings("unchecked")
public A getAnnotation(Class annotationClass) {
if(annotationClass == null) {
throw new NullPointerException();
@@ -1220,6 +1220,7 @@
}
}
+ @SuppressWarnings("unchecked")
public synchronized Constructor[] getPublicConstructors() {
if (publicConstructors != null) {
return publicConstructors;
@@ -1343,7 +1344,7 @@
private Annotation[] declaredAnnotations;
private Type[] genericInterfaces;
private Type genericSuperclass;
- private TypeVariable[] typeParameters;
+ private TypeVariable>[] typeParameters;
public synchronized Annotation[] getAllAnnotations() {
if (allAnnotations != null) {
@@ -1497,49 +1498,14 @@
return genericSuperclass;
}
- /**
- * Checks if two methods match by name and parameter types.
- * Ignored return type
- *
- * @param m1 one method to check
- * @param m2 the other method to check
- * @return true if they match, false otherwise
- */
- private boolean isMethodMatches(Method m1, Method m2) {
- return m1.getName().equals(m2.getName())
- && isTypeMatches(m1.getParameterTypes(), m2.getParameterTypes());
- }
-
- private void mergeMethods(HashSet names, ArrayList thisMethods,
- Method[] superMethods) {
- for (int i = 0; i < superMethods.length; i++) {
- Method superMethod = superMethods[i];
- if (names.contains(superMethod.getName())) {
- int j;
- for (j = 0; j < thisMethods.size(); j++) {
- Method thisMethod = (Method)thisMethods.get(j);
- if (isMethodMatches(thisMethod, superMethod)) {
- break;
- }
- }
- if (j >= thisMethods.size()) {
- thisMethods.add(superMethod);
- names.add(superMethod.getName());
- }
- } else {
- thisMethods.add(superMethod);
- names.add(superMethod.getName());
- }
- }
- }
-
- public synchronized TypeVariable[] getTypeParameters() {
+ @SuppressWarnings("unchecked")
+ public synchronized TypeVariable>[] getTypeParameters() {
//So, here it can be only TypeVariable elements.
if (typeParameters == null) {
Object startPoint = (Object) Class.this;
String signature = AuxiliaryUtil.toUTF8(VMGenericsAndAnnotations.getSignature(Class.this)); // getting this class signature
if (signature == null) {
- return typeParameters = new TypeVariable[0];
+ return typeParameters = new TypeVariable[0];
}
InterimClassGenericDecl decl = (InterimClassGenericDecl) Parser.parseSignature(signature, SignatureKind.CLASS_SIGNATURE, (GenericDeclaration)startPoint); // GenericSignatureFormatError can be thrown here
InterimTypeParameter[] pTypeParameters = decl.typeParameters;
Index: vm/vmcore/src/kernel_classes/javasrc/java/lang/Object.java
===================================================================
--- vm/vmcore/src/kernel_classes/javasrc/java/lang/Object.java (revision 529804)
+++ vm/vmcore/src/kernel_classes/javasrc/java/lang/Object.java (working copy)
@@ -27,10 +27,6 @@
*/
public class Object {
- private static final int TM_ERROR_NONE = 0;
- private static final int TM_ERROR_INTERRUPT = 52;
- private static final int TM_ERROR_ILLEGAL_STATE = 118;
-
public final Class extends Object> getClass() {
return VMClassRegistry.getClass(this);
}
@@ -108,4 +104,5 @@
protected void finalize() throws Throwable {
}
-}
\ No newline at end of file
+
+}
Index: vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java
===================================================================
--- vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java (revision 529804)
+++ vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java (working copy)
@@ -967,14 +967,6 @@
}
/**
- * Associate current thread object with native thread structure.
- */
- private void initNativeThread() {
-
- }
-
-
- /**
* Initializes local values represented by
* InheritableThreadLocal objects having local values for the
* parent thread
Index: vm/vmcore/src/kernel_classes/javasrc/java/lang/ThreadWeakRef.java
===================================================================
--- vm/vmcore/src/kernel_classes/javasrc/java/lang/ThreadWeakRef.java (revision 529804)
+++ vm/vmcore/src/kernel_classes/javasrc/java/lang/ThreadWeakRef.java (working copy)
@@ -22,13 +22,13 @@
import java.lang.ref.WeakReference;
import java.lang.ref.ReferenceQueue;
-class ThreadWeakRef extends WeakReference {
+class ThreadWeakRef extends WeakReference {
- private static ReferenceQueue refQueue = new ReferenceQueue();
+ private static ReferenceQueue refQueue = new ReferenceQueue();
private long nativeAddr = 0;
public ThreadWeakRef(Thread thread) {
- super (thread, ThreadWeakRef.refQueue);
+ super(thread, ThreadWeakRef.refQueue);
}
public void setNativeAddr(long newAddr) {
Index: vm/vmcore/src/kernel_classes/javasrc/java/lang/Runtime.java
===================================================================
--- vm/vmcore/src/kernel_classes/javasrc/java/lang/Runtime.java (revision 529804)
+++ vm/vmcore/src/kernel_classes/javasrc/java/lang/Runtime.java (working copy)
@@ -380,7 +380,7 @@
*/
private static Runtime thisApplicationRuntime = new Runtime();
- private static ArrayList hooksList = new ArrayList();
+ private static ArrayList hooksList = new ArrayList();
/**
* 0 - normal work
@@ -412,14 +412,14 @@
try {
// Phase1: Execute all registered hooks.
VMState = 1;
- for (int i = 0; i < hooksList.size(); i++) {
- ((Thread)hooksList.get(i)).start();
+ for (Thread hook : hooksList) {
+ hook.start();
}
-
- for (int i = 0; i < hooksList.size(); i++) {
+
+ for (Thread hook : hooksList) {
while (true){
try {
- ((Thread)hooksList.get(i)).join();
+ hook.join();
break;
} catch (InterruptedException e) {
continue;
@@ -483,10 +483,10 @@
throw new IllegalStateException();
}
synchronized (hooksList) {
- if (hooksList.contains((Object) hook)) {
+ if (hooksList.contains(hook)) {
throw new IllegalArgumentException();
}
- hooksList.add((Object) hook);
+ hooksList.add(hook);
}
}
@@ -506,7 +506,7 @@
throw new IllegalStateException();
}
synchronized (hooksList) {
- return hooksList.remove((Object) hook);
+ return hooksList.remove(hook);
}
}
@@ -765,7 +765,7 @@
//String[] paths = allPaths.split(pathSeparator);
String[] paths;
{
- java.util.ArrayList res = new java.util.ArrayList();
+ ArrayList res = new ArrayList();
int curPos = 0;
int l = pathSeparator.length();
int i = allPaths.indexOf(pathSeparator);
@@ -822,5 +822,4 @@
//XXX: return new BufferedOutputStream( (OutputStream) (Object) new OutputStreamWriter( out ) );
return out;
}
-
}
Index: vm/vmcore/src/kernel_classes/javasrc/java/lang/Package.java
===================================================================
--- vm/vmcore/src/kernel_classes/javasrc/java/lang/Package.java (revision 529804)
+++ vm/vmcore/src/kernel_classes/javasrc/java/lang/Package.java (working copy)
@@ -70,6 +70,7 @@
* @com.intel.drl.spec_ref
*
**/
+ @SuppressWarnings("unchecked")
public A getAnnotation(Class annotationClass) {
if(annotationClass == null) {
throw new NullPointerException();
Index: vm/vmcore/src/kernel_classes/javasrc/java/lang/VMExecutionEngine.java
===================================================================
--- vm/vmcore/src/kernel_classes/javasrc/java/lang/VMExecutionEngine.java (revision 529804)
+++ vm/vmcore/src/kernel_classes/javasrc/java/lang/VMExecutionEngine.java (working copy)
@@ -20,7 +20,6 @@
*/
package java.lang;
-import java.util.Map;
import java.util.Properties;
import java.util.Vector;
Index: vm/vmcore/src/kernel_classes/javasrc/java/lang/ClassLoader.java
===================================================================
--- vm/vmcore/src/kernel_classes/javasrc/java/lang/ClassLoader.java (revision 529804)
+++ vm/vmcore/src/kernel_classes/javasrc/java/lang/ClassLoader.java (working copy)
@@ -645,6 +645,7 @@
/**
* Initializes the system class loader.
*/
+ @SuppressWarnings("unchecked")
private static void initSystemClassLoader() {
if (systemClassLoader != null) {
throw new IllegalStateException(
@@ -665,7 +666,7 @@
+ " must inherit java.lang.SecurityManager");
}
}
- AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ AccessController.doPrivileged(new PrivilegedExceptionAction