homberghp commented on code in PR #8197: URL: https://github.com/apache/netbeans/pull/8197#discussion_r1930572170
########## java/refactoring.java/test/unit/src/org/netbeans/modules/refactoring/java/test/InnerOuterRecordTest.java: ########## @@ -0,0 +1,713 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.netbeans.modules.refactoring.java.test; + +import com.sun.source.tree.ClassTree; +import com.sun.source.tree.CompilationUnitTree; +import com.sun.source.tree.Tree; +import com.sun.source.util.TreePath; +import java.io.IOException; +import java.time.LocalDate; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; +import javax.lang.model.SourceVersion; +import javax.lang.model.element.Name; +import org.junit.FixMethodOrder; +import org.junit.runners.MethodSorters; +import org.netbeans.api.java.source.CompilationController; +import org.netbeans.api.java.source.JavaSource; +import org.netbeans.api.java.source.Task; +import org.netbeans.api.java.source.TreePathHandle; +import org.netbeans.modules.refactoring.api.Problem; +import org.netbeans.modules.refactoring.api.RefactoringSession; +import org.netbeans.modules.refactoring.java.api.InnerToOuterRefactoring; +import static org.netbeans.modules.refactoring.java.test.RefactoringTestBase.addAllProblems; +import org.openide.util.Exceptions; + +/** + * Test inner to outer refactoring for test. + * + * In the input files, and the expected outcomes, the indentation does not + * really matter as far as the tests are concerned because the indentation is + * stripped away before the remaining source lines are compared to the expected + * lines. + * + * @author homberghp {@code <[email protected])>} + */ +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class InnerOuterRecordTest extends RefactoringTestBase { + + public InnerOuterRecordTest(String name) { + super(name); + //ensure we are running on at least 16. + try { + SourceVersion.valueOf("RELEASE_16"); //NOI18N + } catch (IllegalArgumentException ex) { + //OK, no RELEASE_16, skip test + throw new RuntimeException("need at least Java 16 for record"); + } + } + + // for reference + public void test0_259004() throws Exception { + String source + = """ + package t; + + import java.util.function.Consumer; + + public class A { + + public static void main(String[] args) { + Consumer<F> c = f -> {}; + } + + public static final class F {} + }"""; Review Comment: I agree, for a better look. But: this is what the 'default' formatting makes of it. See issue issue #8130. ########## java/java.source.base/src/org/netbeans/modules/java/source/base/SourceLevelUtils.java: ########## @@ -34,6 +34,13 @@ public class SourceLevelUtils { public static final Source JDK1_9 = Source.lookup("9"); public static final Source JDK14 = Source.lookup("14"); public static final Source JDK15 = Source.lookup("15"); + public static final Source JDK16 = Source.lookup("16"); + public static final Source JDK17 = Source.lookup("17"); + // for next release: +// public static final Source JDK18 = Source.lookup("18"); +// public static final Source JDK19 = Source.lookup("19"); +// public static final Source JDK20 = Source.lookup("20"); +// public static final Source JDK21 = Source.lookup("21"); Review Comment: JDK17 should be. JDK16 is the version that made record a definitive feature. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
