author | sogoel |
Thu, 05 Jun 2014 10:57:10 -0700 | |
changeset 24797 | 850ebd4d80a7 |
parent 18009 | f47ea7c9c3f4 |
child 30730 | d3ce7619db2c |
permissions | -rw-r--r-- |
18009
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
1 |
/* |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
2 |
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
4 |
* |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
10 |
* |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
15 |
* accompanied this code). |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
16 |
* |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
20 |
* |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
23 |
* questions. |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
24 |
*/ |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
25 |
|
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
26 |
/* |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
27 |
* @test |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
28 |
* @bug 7165659 |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
29 |
* @summary javac incorrectly sets strictfp access flag on inner-classes |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
30 |
*/ |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
31 |
|
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
32 |
import java.io.File; |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
33 |
|
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
34 |
import com.sun.tools.classfile.AccessFlags; |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
35 |
import com.sun.tools.classfile.Attribute; |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
36 |
import com.sun.tools.classfile.ClassFile; |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
37 |
import com.sun.tools.classfile.InnerClasses_attribute; |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
38 |
import com.sun.tools.classfile.InnerClasses_attribute.Info; |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
39 |
import com.sun.tools.javac.util.Assert; |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
40 |
|
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
41 |
public class InnerClassAttrMustNotHaveStrictFPFlagTest { |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
42 |
|
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
43 |
public static void main(String[] args) throws Exception { |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
44 |
new InnerClassAttrMustNotHaveStrictFPFlagTest().run(); |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
45 |
} |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
46 |
|
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
47 |
private void run() throws Exception { |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
48 |
File classPath = new File(System.getProperty("test.classes"), getClass().getSimpleName() + ".class"); |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
49 |
analyzeClassFile(classPath); |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
50 |
} |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
51 |
|
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
52 |
void analyzeClassFile(File path) throws Exception { |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
53 |
ClassFile classFile = ClassFile.read(path); |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
54 |
InnerClasses_attribute innerClasses = |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
55 |
(InnerClasses_attribute) classFile.attributes.get(Attribute.InnerClasses); |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
56 |
for (Info classInfo : innerClasses.classes) { |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
57 |
Assert.check(!classInfo.inner_class_access_flags.is(AccessFlags.ACC_STRICT), |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
58 |
"Inner classes attribute must not have the ACC_STRICT flag set"); |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
59 |
} |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
60 |
} |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
61 |
|
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
62 |
strictfp void m() { |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
63 |
new Runnable() { |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
64 |
@Override |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
65 |
public void run() {} |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
66 |
}; |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
67 |
} |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
68 |
|
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
69 |
static strictfp class Strict extends InnerClassAttrMustNotHaveStrictFPFlagTest {} |
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
70 |
|
f47ea7c9c3f4
7165659: javac incorrectly sets strictfp access flag on inner-classes
vromero
parents:
diff
changeset
|
71 |
} |