7068617: Core libraries don't build with javac -Xlint:all -Werror
authorjjg
Wed, 20 Jul 2011 12:19:41 -0700
changeset 10129 bf705e446ca1
parent 10128 f505a8514bd7
child 10130 254e206a89d8
7068617: Core libraries don't build with javac -Xlint:all -Werror Reviewed-by: darcy Contributed-by: alexandre.boulgakov@oracle.com
jdk/make/java/java/Makefile
jdk/src/share/classes/sun/reflect/generics/reflectiveObjects/NotImplementedException.java
jdk/src/share/classes/sun/reflect/misc/ConstructorUtil.java
jdk/src/share/classes/sun/reflect/misc/FieldUtil.java
jdk/src/share/classes/sun/reflect/misc/MethodUtil.java
jdk/src/share/classes/sun/reflect/misc/ReflectUtil.java
--- a/jdk/make/java/java/Makefile	Tue Jul 19 21:47:23 2011 -0700
+++ b/jdk/make/java/java/Makefile	Wed Jul 20 12:19:41 2011 -0700
@@ -32,6 +32,8 @@
 PACKAGE = java.lang
 LIBRARY = java
 PRODUCT = java
+SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true
+SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
 include $(BUILDDIR)/common/Defs.gmk
 
 # windows compiler flags
--- a/jdk/src/share/classes/sun/reflect/generics/reflectiveObjects/NotImplementedException.java	Tue Jul 19 21:47:23 2011 -0700
+++ b/jdk/src/share/classes/sun/reflect/generics/reflectiveObjects/NotImplementedException.java	Wed Jul 20 12:19:41 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,4 +26,6 @@
 package sun.reflect.generics.reflectiveObjects;
 
 /** Temporary class used to indicate missing functionality */
-public class NotImplementedException extends RuntimeException {}
+public class NotImplementedException extends RuntimeException {
+    private static final long serialVersionUID = -9177857708926624790L;
+}
--- a/jdk/src/share/classes/sun/reflect/misc/ConstructorUtil.java	Tue Jul 19 21:47:23 2011 -0700
+++ b/jdk/src/share/classes/sun/reflect/misc/ConstructorUtil.java	Wed Jul 20 12:19:41 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,13 +32,13 @@
     private ConstructorUtil() {
     }
 
-    public static Constructor getConstructor(Class cls, Class[] params)
+    public static Constructor<?> getConstructor(Class<?> cls, Class<?>[] params)
         throws NoSuchMethodException {
         ReflectUtil.checkPackageAccess(cls);
         return cls.getConstructor(params);
     }
 
-    public static Constructor[] getConstructors(Class cls) {
+    public static Constructor<?>[] getConstructors(Class<?> cls) {
         ReflectUtil.checkPackageAccess(cls);
         return cls.getConstructors();
     }
--- a/jdk/src/share/classes/sun/reflect/misc/FieldUtil.java	Tue Jul 19 21:47:23 2011 -0700
+++ b/jdk/src/share/classes/sun/reflect/misc/FieldUtil.java	Wed Jul 20 12:19:41 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,18 +35,18 @@
     private FieldUtil() {
     }
 
-    public static Field getField(Class cls, String name)
+    public static Field getField(Class<?> cls, String name)
         throws NoSuchFieldException {
         ReflectUtil.checkPackageAccess(cls);
         return cls.getField(name);
     }
 
-    public static Field[] getFields(Class cls) {
+    public static Field[] getFields(Class<?> cls) {
         ReflectUtil.checkPackageAccess(cls);
         return cls.getFields();
     }
 
-    public static Field[] getDeclaredFields(Class cls) {
+    public static Field[] getDeclaredFields(Class<?> cls) {
         ReflectUtil.checkPackageAccess(cls);
         return cls.getDeclaredFields();
     }
--- a/jdk/src/share/classes/sun/reflect/misc/MethodUtil.java	Tue Jul 19 21:47:23 2011 -0700
+++ b/jdk/src/share/classes/sun/reflect/misc/MethodUtil.java	Wed Jul 20 12:19:41 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,17 +36,13 @@
 import java.io.IOException;
 import java.net.URL;
 import java.net.URLConnection;
-import java.net.HttpURLConnection;
 import java.lang.reflect.Method;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.AccessibleObject;
 import java.lang.reflect.Modifier;
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 import sun.misc.IOUtils;
-import sun.net.www.ParseUtil;
-import sun.security.util.SecurityConstants;
 
 
 class Trampoline {
@@ -68,13 +64,13 @@
         super();
     }
 
-    public static Method getMethod(Class<?> cls, String name, Class[] args)
+    public static Method getMethod(Class<?> cls, String name, Class<?>[] args)
         throws NoSuchMethodException {
         ReflectUtil.checkPackageAccess(cls);
         return cls.getMethod(name, args);
     }
 
-    public static Method[] getMethods(Class cls) {
+    public static Method[] getMethods(Class<?> cls) {
         ReflectUtil.checkPackageAccess(cls);
         return cls.getMethods();
     }
@@ -85,7 +81,7 @@
      * Class.getMethods() and walking towards Object until
      * we're done.
      */
-     public static Method[] getPublicMethods(Class cls) {
+     public static Method[] getPublicMethods(Class<?> cls) {
         // compatibility for update release
         if (System.getSecurityManager() == null) {
             return cls.getMethods();
@@ -105,11 +101,11 @@
     /*
      * Process the immediate interfaces of this class or interface.
      */
-    private static void getInterfaceMethods(Class cls,
+    private static void getInterfaceMethods(Class<?> cls,
                                             Map<Signature, Method> sigs) {
-        Class[] intfs = cls.getInterfaces();
+        Class<?>[] intfs = cls.getInterfaces();
         for (int i=0; i < intfs.length; i++) {
-            Class intf = intfs[i];
+            Class<?> intf = intfs[i];
             boolean done = getInternalPublicMethods(intf, sigs);
             if (!done) {
                 getInterfaceMethods(intf, sigs);
@@ -121,7 +117,7 @@
      *
      * Process the methods in this class or interface
      */
-    private static boolean getInternalPublicMethods(Class cls,
+    private static boolean getInternalPublicMethods(Class<?> cls,
                                                     Map<Signature, Method> sigs) {
         Method[] methods = null;
         try {
@@ -150,7 +146,7 @@
          */
         boolean done = true;
         for (int i=0; i < methods.length; i++) {
-            Class dc = methods[i].getDeclaringClass();
+            Class<?> dc = methods[i].getDeclaringClass();
             if (!Modifier.isPublic(dc.getModifiers())) {
                 done = false;
                 break;
@@ -171,7 +167,7 @@
              * stripping away inherited methods.
              */
             for (int i=0; i < methods.length; i++) {
-                Class dc = methods[i].getDeclaringClass();
+                Class<?> dc = methods[i].getDeclaringClass();
                 if (cls.equals(dc)) {
                     addMethod(sigs, methods[i]);
                 }
@@ -301,12 +297,12 @@
     }
 
 
-    protected synchronized Class loadClass(String name, boolean resolve)
+    protected synchronized Class<?> loadClass(String name, boolean resolve)
         throws ClassNotFoundException
     {
         // First, check if the class has already been loaded
         ReflectUtil.checkPackageAccess(name);
-        Class c = findLoadedClass(name);
+        Class<?> c = findLoadedClass(name);
         if (c == null) {
             try {
                 c = findClass(name);
@@ -324,7 +320,7 @@
     }
 
 
-    protected Class findClass(final String name)
+    protected Class<?> findClass(final String name)
         throws ClassNotFoundException
     {
         if (!name.startsWith(MISC_PKG)) {
@@ -347,7 +343,7 @@
     /*
      * Define the proxy classes
      */
-    private Class defineClass(String name, URL url) throws IOException {
+    private Class<?> defineClass(String name, URL url) throws IOException {
         byte[] b = getBytes(url);
         CodeSource cs = new CodeSource(null, (java.security.cert.Certificate[])null);
         if (!name.equals(TRAMPOLINE)) {
@@ -389,7 +385,7 @@
         return perms;
     }
 
-    private static Class getTrampolineClass() {
+    private static Class<?> getTrampolineClass() {
         try {
             return Class.forName(TRAMPOLINE, true, new MethodUtil());
         } catch (ClassNotFoundException e) {
--- a/jdk/src/share/classes/sun/reflect/misc/ReflectUtil.java	Tue Jul 19 21:47:23 2011 -0700
+++ b/jdk/src/share/classes/sun/reflect/misc/ReflectUtil.java	Wed Jul 20 12:19:41 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,13 +34,13 @@
     private ReflectUtil() {
     }
 
-    public static Class forName(String name)
+    public static Class<?> forName(String name)
         throws ClassNotFoundException {
         checkPackageAccess(name);
         return Class.forName(name);
     }
 
-    public static Object newInstance(Class cls)
+    public static Object newInstance(Class<?> cls)
         throws InstantiationException, IllegalAccessException {
         checkPackageAccess(cls);
         return cls.newInstance();
@@ -50,8 +50,8 @@
      * Reflection.ensureMemberAccess is overly-restrictive
      * due to a bug. We awkwardly work around it for now.
      */
-    public static void ensureMemberAccess(Class currentClass,
-                                          Class memberClass,
+    public static void ensureMemberAccess(Class<?> currentClass,
+                                          Class<?> memberClass,
                                           Object target,
                                           int modifiers)
         throws IllegalAccessException
@@ -102,8 +102,8 @@
         }
     }
 
-    private static boolean isSubclassOf(Class queryClass,
-                                Class ofClass)
+    private static boolean isSubclassOf(Class<?> queryClass,
+                                        Class<?> ofClass)
     {
         while (queryClass != null) {
             if (queryClass == ofClass) {
@@ -115,7 +115,7 @@
     }
 
 
-    public static void checkPackageAccess(Class clazz) {
+    public static void checkPackageAccess(Class<?> clazz) {
         checkPackageAccess(clazz.getName());
     }
 
@@ -136,7 +136,7 @@
         }
     }
 
-    public static boolean isPackageAccessible(Class clazz) {
+    public static boolean isPackageAccessible(Class<?> clazz) {
         try {
             checkPackageAccess(clazz);
         } catch (SecurityException e) {