8191938: Fix lint warnings in JAXP repo: a few Deprecation warrnings and enable -Xlint:all
authorjoehw
Fri, 01 Dec 2017 10:02:25 -0800
changeset 48041 2743e489189e
parent 48040 26f1193f1348
child 48042 be01bcb72309
child 48266 195b82f9f7d1
8191938: Fix lint warnings in JAXP repo: a few Deprecation warrnings and enable -Xlint:all Reviewed-by: darcy, rriggs
make/CompileJavaModules.gmk
src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantDouble.java
src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantFloat.java
src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DCONST.java
src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FCONST.java
src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INVOKEDYNAMIC.java
src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionFactory.java
src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LDC.java
src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LDC2_W.java
--- a/make/CompileJavaModules.gmk	Fri Dec 01 09:46:36 2017 -0800
+++ b/make/CompileJavaModules.gmk	Fri Dec 01 10:02:25 2017 -0800
@@ -300,7 +300,9 @@
 
 ################################################################################
 
-java.xml_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
+java.xml_ADD_JAVAC_FLAGS += -Xdoclint:all/protected \
+    '-Xdoclint/package:$(call CommaList, javax.xml.catalog javax.xml.datatype \
+    javax.xml.transform javax.xml.validation javax.xml.xpath)'
 java.xml_CLEAN += .properties
 
 ################################################################################
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantDouble.java	Fri Dec 01 09:46:36 2017 -0800
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantDouble.java	Fri Dec 01 10:02:25 2017 -0800
@@ -32,6 +32,7 @@
  *
  * @version $Id: ConstantDouble.java 1747278 2016-06-07 17:28:43Z britter $
  * @see     Constant
+ * @LastModified: Nov 2017
  */
 public final class ConstantDouble extends Constant implements ConstantObject {
 
@@ -121,6 +122,6 @@
      */
     @Override
     public Object getConstantValue( final ConstantPool cp ) {
-        return new Double(bytes);
+        return bytes;
     }
 }
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantFloat.java	Fri Dec 01 09:46:36 2017 -0800
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantFloat.java	Fri Dec 01 10:02:25 2017 -0800
@@ -32,6 +32,7 @@
  *
  * @version $Id: ConstantFloat.java 1747278 2016-06-07 17:28:43Z britter $
  * @see     Constant
+ * @LastModified: Nov 2017
  */
 public final class ConstantFloat extends Constant implements ConstantObject {
 
@@ -122,6 +123,6 @@
      */
     @Override
     public Object getConstantValue( final ConstantPool cp ) {
-        return new Float(bytes);
+        return bytes;
     }
 }
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DCONST.java	Fri Dec 01 09:46:36 2017 -0800
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DCONST.java	Fri Dec 01 10:02:25 2017 -0800
@@ -26,6 +26,7 @@
  * <PRE>Stack: ... -&gt; ..., </PRE>
  *
  * @version $Id: DCONST.java 1747278 2016-06-07 17:28:43Z britter $
+ * @LastModified: Nov 2017
  */
 public class DCONST extends Instruction implements ConstantPushInstruction {
 
@@ -55,7 +56,7 @@
 
     @Override
     public Number getValue() {
-        return new Double(value);
+        return value;
     }
 
 
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FCONST.java	Fri Dec 01 09:46:36 2017 -0800
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FCONST.java	Fri Dec 01 10:02:25 2017 -0800
@@ -26,6 +26,7 @@
  * <PRE>Stack: ... -&gt; ..., </PRE>
  *
  * @version $Id: FCONST.java 1747278 2016-06-07 17:28:43Z britter $
+ * @LastModified: Nov 2017
  */
 public class FCONST extends Instruction implements ConstantPushInstruction {
 
@@ -57,7 +58,7 @@
 
     @Override
     public Number getValue() {
-        return new Float(value);
+        return value;
     }
 
 
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INVOKEDYNAMIC.java	Fri Dec 01 09:46:36 2017 -0800
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INVOKEDYNAMIC.java	Fri Dec 01 10:02:25 2017 -0800
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -41,6 +40,7 @@
  * <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.invokedynamic">
  * The invokedynamic instruction in The Java Virtual Machine Specification</a>
  * @since 6.0
+ * @LastModified: Nov 2017
  */
 public class INVOKEDYNAMIC extends InvokeInstruction {
 
@@ -124,8 +124,14 @@
 
     /**
      * Override the parent method because our classname is held elsewhere.
+     *
+     * @param cpg the ConstantPool generator
+     * @deprecated in FieldOrMethod
+     *
+     * @return name of the referenced class/interface
      */
     @Override
+    @Deprecated
     public String getClassName( final ConstantPoolGen cpg ) {
         final ConstantPool cp = cpg.getConstantPool();
         final ConstantInvokeDynamic cid = (ConstantInvokeDynamic) cp.getConstant(super.getIndex(), Const.CONSTANT_InvokeDynamic);
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionFactory.java	Fri Dec 01 09:46:36 2017 -0800
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionFactory.java	Fri Dec 01 10:02:25 2017 -0800
@@ -32,6 +32,7 @@
  * @version $Id: InstructionFactory.java 1749603 2016-06-21 20:50:19Z ggregory $
  * @see Const
  * @see InstructionConst
+ * @LastModified: Nov 2017
  */
 public class InstructionFactory {
 
@@ -573,7 +574,7 @@
                     + short_names[dest - Const.T_CHAR];
             Instruction i = null;
             try {
-                i = (Instruction) java.lang.Class.forName(name).newInstance();
+                i = (Instruction) java.lang.Class.forName(name).getDeclaredConstructor().newInstance();
             } catch (final Exception e) {
                 throw new RuntimeException("Could not find instruction: " + name, e);
             }
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LDC.java	Fri Dec 01 09:46:36 2017 -0800
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LDC.java	Fri Dec 01 10:02:25 2017 -0800
@@ -32,6 +32,7 @@
  * <PRE>Stack: ... -&gt; ..., item</PRE>
  *
  * @version $Id: LDC.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @LastModified: Nov 2017
  */
 public class LDC extends CPInstruction implements PushInstruction, ExceptionThrower {
 
@@ -104,9 +105,9 @@
                 c = cpg.getConstantPool().getConstant(i);
                 return ((com.sun.org.apache.bcel.internal.classfile.ConstantUtf8) c).getBytes();
             case com.sun.org.apache.bcel.internal.Const.CONSTANT_Float:
-                return new Float(((com.sun.org.apache.bcel.internal.classfile.ConstantFloat) c).getBytes());
+                return ((com.sun.org.apache.bcel.internal.classfile.ConstantFloat) c).getBytes();
             case com.sun.org.apache.bcel.internal.Const.CONSTANT_Integer:
-                return Integer.valueOf(((com.sun.org.apache.bcel.internal.classfile.ConstantInteger) c).getBytes());
+                return ((com.sun.org.apache.bcel.internal.classfile.ConstantInteger) c).getBytes();
             case com.sun.org.apache.bcel.internal.Const.CONSTANT_Class:
                 final int nameIndex = ((com.sun.org.apache.bcel.internal.classfile.ConstantClass) c).getNameIndex();
                 c = cpg.getConstantPool().getConstant(nameIndex);
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LDC2_W.java	Fri Dec 01 09:46:36 2017 -0800
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LDC2_W.java	Fri Dec 01 10:02:25 2017 -0800
@@ -26,6 +26,7 @@
  * <PRE>Stack: ... -&gt; ..., item.word1, item.word2</PRE>
  *
  * @version $Id: LDC2_W.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @LastModified: Nov 2017
  */
 public class LDC2_W extends CPInstruction implements PushInstruction {
 
@@ -59,9 +60,9 @@
         final com.sun.org.apache.bcel.internal.classfile.Constant c = cpg.getConstantPool().getConstant(super.getIndex());
         switch (c.getTag()) {
             case com.sun.org.apache.bcel.internal.Const.CONSTANT_Long:
-                return Long.valueOf(((com.sun.org.apache.bcel.internal.classfile.ConstantLong) c).getBytes());
+                return ((com.sun.org.apache.bcel.internal.classfile.ConstantLong) c).getBytes();
             case com.sun.org.apache.bcel.internal.Const.CONSTANT_Double:
-                return new Double(((com.sun.org.apache.bcel.internal.classfile.ConstantDouble) c).getBytes());
+                return ((com.sun.org.apache.bcel.internal.classfile.ConstantDouble) c).getBytes();
             default: // Never reached
                 throw new RuntimeException("Unknown or invalid constant type at " + super.getIndex());
         }