test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesTestBase.java
changeset 50735 2f2af62dfac7
parent 47216 71c04702a3d5
equal deleted inserted replaced
50734:0828a0f6676b 50735:2f2af62dfac7
     1 /*
     1 /*
     2  * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   197 
   197 
   198     private void test(String classToTest, TestCase test, String...skipClasses) {
   198     private void test(String classToTest, TestCase test, String...skipClasses) {
   199         printf("Testing :\n%s\n", test.getSource());
   199         printf("Testing :\n%s\n", test.getSource());
   200         try {
   200         try {
   201             Map<String, Set<String>> class2Flags = test.getFlags();
   201             Map<String, Set<String>> class2Flags = test.getFlags();
   202             ClassFile cf = readClassFile(compile(test.getSource())
   202             ClassFile cf = readClassFile(compile(getCompileOptions(), test.getSource())
   203                     .getClasses().get(classToTest));
   203                     .getClasses().get(classToTest));
   204             InnerClasses_attribute innerClasses = (InnerClasses_attribute)
   204             InnerClasses_attribute innerClasses = (InnerClasses_attribute)
   205                     cf.getAttribute(Attribute.InnerClasses);
   205                     cf.getAttribute(Attribute.InnerClasses);
   206             int count = 0;
   206             int count = 0;
   207             for (Attribute a : cf.attributes.attrs) {
   207             for (Attribute a : cf.attributes.attrs) {
   322                 .collect(Collectors.toSet());
   322                 .collect(Collectors.toSet());
   323         type.addSpecificFlags(flags);
   323         type.addSpecificFlags(flags);
   324         return flags;
   324         return flags;
   325     }
   325     }
   326 
   326 
       
   327     protected List<String> getCompileOptions() {
       
   328         return Collections.emptyList();
       
   329     }
       
   330 
   327     private List<List<Modifier>> getAllCombinations(Modifier[] accessModifiers, Modifier[] otherModifiers) {
   331     private List<List<Modifier>> getAllCombinations(Modifier[] accessModifiers, Modifier[] otherModifiers) {
   328         List<List<Modifier>> list = new ArrayList<>();
   332         List<List<Modifier>> list = new ArrayList<>();
   329         for (Modifier access : accessModifiers) {
   333         for (Modifier access : accessModifiers) {
   330             for (int i = 0; i < otherModifiers.length; ++i) {
   334             for (int i = 0; i < otherModifiers.length; ++i) {
   331                 Modifier mod1 = otherModifiers[i];
   335                 Modifier mod1 = otherModifiers[i];