-
Bug
-
Resolution: Fixed
-
P4
-
7, 8, 9
-
b143
-
x86_64
-
linux
-
Verified
FULL PRODUCT VERSION :
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) Client VM (build 25.65-b01, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux mebigfatguy 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:31:42 UTC 2014 i686 i686 i686 GNU/Linux
EXTRA RELEVANT SYSTEM CONFIGURATION :
same problem exists on 101
A DESCRIPTION OF THE PROBLEM :
When an anonymous class is created based on a class who's constructor throws a checked exception, that anonymous class' constructor has no ExceptionTable attributes, documenting the parent class's exception. Even though that anonymous class constructor is calling the super class's constructor.
This causes problem for static code analysis
REGRESSION. Last worked in version 7u80
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Given this code
import java.io.InputStream;
import java.io.IOException;
public class AnonBase {
AnonBase(InputStream is) throws IOException {
int i = is.read();
}
public static AnonBase makeAnon(InputStream is) throws IOException {
return new AnonBase(is) {
};
}
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
You'd expect the constructor of AnonBase$1 to have an ExceptionTable attribute that houses IOException
ACTUAL -
You actually get
{
AnonBase$1(java.io.InputStream);
descriptor: (Ljava/io/InputStream;)V
flags:
Code:
stack=2, locals=2, args_size=2
0: aload_0
1: aload_1
2: invokespecial #1 // Method AnonBase."<init>":(Ljava/io/InputStream;)V
5: return
LineNumberTable:
line 11: 0
LocalVariableTable:
Start Length Slot Name Signature
0 6 0 this LAnonBase$1;
0 6 1 is Ljava/io/InputStream;
}
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.InputStream;
import java.io.IOException;
public class AnonBase {
AnonBase(InputStream is) throws IOException {
int i = is.read();
}
public static AnonBase makeAnon(InputStream is) throws IOException {
return new AnonBase(is) {
};
}
}
---------- END SOURCE ----------
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) Client VM (build 25.65-b01, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux mebigfatguy 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:31:42 UTC 2014 i686 i686 i686 GNU/Linux
EXTRA RELEVANT SYSTEM CONFIGURATION :
same problem exists on 101
A DESCRIPTION OF THE PROBLEM :
When an anonymous class is created based on a class who's constructor throws a checked exception, that anonymous class' constructor has no ExceptionTable attributes, documenting the parent class's exception. Even though that anonymous class constructor is calling the super class's constructor.
This causes problem for static code analysis
REGRESSION. Last worked in version 7u80
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Given this code
import java.io.InputStream;
import java.io.IOException;
public class AnonBase {
AnonBase(InputStream is) throws IOException {
int i = is.read();
}
public static AnonBase makeAnon(InputStream is) throws IOException {
return new AnonBase(is) {
};
}
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
You'd expect the constructor of AnonBase$1 to have an ExceptionTable attribute that houses IOException
ACTUAL -
You actually get
{
AnonBase$1(java.io.InputStream);
descriptor: (Ljava/io/InputStream;)V
flags:
Code:
stack=2, locals=2, args_size=2
0: aload_0
1: aload_1
2: invokespecial #1 // Method AnonBase."<init>":(Ljava/io/InputStream;)V
5: return
LineNumberTable:
line 11: 0
LocalVariableTable:
Start Length Slot Name Signature
0 6 0 this LAnonBase$1;
0 6 1 is Ljava/io/InputStream;
}
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.InputStream;
import java.io.IOException;
public class AnonBase {
AnonBase(InputStream is) throws IOException {
int i = is.read();
}
public static AnonBase makeAnon(InputStream is) throws IOException {
return new AnonBase(is) {
};
}
}
---------- END SOURCE ----------