8191938: Fix lint warnings in JAXP repo: a few Deprecation warrnings and enable -Xlint:all

Reviewed-by: darcy, rriggs
This commit is contained in:
Joe Wang 2017-12-01 10:02:25 -08:00
parent 278eaa6135
commit ecd302728c
9 changed files with 27 additions and 12 deletions

View File

@ -300,7 +300,9 @@ java.corba_EXCLUDE_FILES += \
################################################################################
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
################################################################################

View File

@ -32,6 +32,7 @@ import com.sun.org.apache.bcel.internal.Const;
*
* @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 @@ public final class ConstantDouble extends Constant implements ConstantObject {
*/
@Override
public Object getConstantValue( final ConstantPool cp ) {
return new Double(bytes);
return bytes;
}
}

View File

@ -32,6 +32,7 @@ import com.sun.org.apache.bcel.internal.Const;
*
* @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 @@ public final class ConstantFloat extends Constant implements ConstantObject {
*/
@Override
public Object getConstantValue( final ConstantPool cp ) {
return new Float(bytes);
return bytes;
}
}

View File

@ -26,6 +26,7 @@ package com.sun.org.apache.bcel.internal.generic;
* <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 @@ public class DCONST extends Instruction implements ConstantPushInstruction {
@Override
public Number getValue() {
return new Double(value);
return value;
}

View File

@ -26,6 +26,7 @@ package com.sun.org.apache.bcel.internal.generic;
* <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 @@ public class FCONST extends Instruction implements ConstantPushInstruction {
@Override
public Number getValue() {
return new Float(value);
return value;
}

View File

@ -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 @@ import com.sun.org.apache.bcel.internal.util.ByteSequence;
* <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 @@ public class INVOKEDYNAMIC extends InvokeInstruction {
/**
* 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);

View File

@ -32,6 +32,7 @@ import com.sun.org.apache.bcel.internal.Const;
* @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 @@ public class InstructionFactory {
+ 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);
}

View File

@ -32,6 +32,7 @@ import com.sun.org.apache.bcel.internal.util.ByteSequence;
* <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 @@ public class LDC extends CPInstruction implements PushInstruction, ExceptionThro
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);

View File

@ -26,6 +26,7 @@ package com.sun.org.apache.bcel.internal.generic;
* <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 @@ public class LDC2_W extends CPInstruction implements PushInstruction {
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());
}