< prev index next >

test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInAnonymousClassTest.java

Print this page
*** 1,7 ***
  /*
!  * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.
--- 1,7 ---
  /*
!  * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.

*** 56,11 ***
      }
  
      @Override
      public List<TestCase> generateTestCases() {
          currentClassType = ClassType.CLASS;
!         setPrefix("class Anonymous {} {new Anonymous() {");
          List<TestCase> sources = super.generateTestCases();
  
          currentClassType = ClassType.INTERFACE;
          setPrefix("interface Anonymous {} {new Anonymous() {");
          sources.addAll(super.generateTestCases());
--- 56,11 ---
      }
  
      @Override
      public List<TestCase> generateTestCases() {
          currentClassType = ClassType.CLASS;
!         setPrefix("class Anonymous { int f; } {new Anonymous() {"); // impose identity to make testing predictable.
          List<TestCase> sources = super.generateTestCases();
  
          currentClassType = ClassType.INTERFACE;
          setPrefix("interface Anonymous {} {new Anonymous() {");
          sources.addAll(super.generateTestCases());

*** 75,8 ***
  
      @Override
      public void getAdditionalFlags(Map<String, Set<String>> class2Flags, ClassType type, Modifier... flags) {
          super.getAdditionalFlags(class2Flags, type, flags);
          class2Flags.put("Anonymous", getFlags(currentClassType, Arrays.asList(flags)));
!         class2Flags.put("1", new HashSet<>() {});
      }
  }
--- 75,8 ---
  
      @Override
      public void getAdditionalFlags(Map<String, Set<String>> class2Flags, ClassType type, Modifier... flags) {
          super.getAdditionalFlags(class2Flags, type, flags);
          class2Flags.put("Anonymous", getFlags(currentClassType, Arrays.asList(flags)));
!         class2Flags.put("1", Set.of());
      }
  }
< prev index next >