From d19de4d901634d85f53217b91d1dfda445d8068d Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Fri, 17 Nov 2023 07:47:16 -0800 Subject: [PATCH 01/30] WIP: 8309381: Create JavaFX incubator module Initial prototype of a javafx.incubator.controls module --- build.gradle | 112 ++++++++++++++++-- .../src/main/java/module-info.java | 1 + .../incubator/scene/control/MyImpl.java | 42 +++++++ .../incubator/scene/control/MyButton.java | 53 +++++++++ .../incubator/scene/control/package-info.java | 32 +++++ .../src/main/java/module-info.java | 41 +++++++ .../incubator/scene/control/MyButtonShim.java | 32 +++++ .../src/test/addExports | 19 +++ .../incubator/scene/control/MyButtonTest.java | 44 +++++++ settings.gradle | 3 +- 10 files changed, 367 insertions(+), 12 deletions(-) create mode 100644 modules/javafx.incubator.controls/src/main/java/com/sun/javafx/incubator/scene/control/MyImpl.java create mode 100644 modules/javafx.incubator.controls/src/main/java/javafx/incubator/scene/control/MyButton.java create mode 100644 modules/javafx.incubator.controls/src/main/java/javafx/incubator/scene/control/package-info.java create mode 100644 modules/javafx.incubator.controls/src/main/java/module-info.java create mode 100644 modules/javafx.incubator.controls/src/shims/java/javafx/incubator/scene/control/MyButtonShim.java create mode 100644 modules/javafx.incubator.controls/src/test/addExports create mode 100644 modules/javafx.incubator.controls/src/test/java/test/javafx/incubator/scene/control/MyButtonTest.java diff --git a/build.gradle b/build.gradle index ea3f49a6869..9c24ce3f056 100644 --- a/build.gradle +++ b/build.gradle @@ -2749,6 +2749,87 @@ project(":controls") { addValidateSourceSets(project, sourceSets) } +project(":incubator.controls") { + project.ext.buildModule = true + project.ext.includeSources = true + project.ext.moduleRuntime = true + project.ext.moduleName = "javafx.incubator.controls" + project.ext.incubating = true + + sourceSets { + main + shims { + java { + compileClasspath += sourceSets.main.output + runtimeClasspath += sourceSets.main.output + } + } + test { + java { + compileClasspath += sourceSets.shims.output + runtimeClasspath += sourceSets.shims.output + } + } + } + + project.ext.moduleSourcePath = defaultModuleSourcePath + project.ext.moduleSourcePathShim = defaultModuleSourcePathShim + + commonModuleSetup(project, [ 'base', 'graphics', 'controls', 'incubator.controls' ]) + + dependencies { + testImplementation project(":base").sourceSets.test.output + testImplementation project(":graphics").sourceSets.test.output + testImplementation project(":controls").sourceSets.test.output + implementation project(':base') + implementation project(':graphics') + implementation project(':controls') + } + + test { + jvmArgs "-Djavafx.toolkit=test.com.sun.javafx.pgstub.StubToolkit" + } + + def modulePath = "${project.sourceSets.main.java.getDestinationDirectory().get().getAsFile()}" + modulePath += File.pathSeparator + "${rootProject.projectDir}/modules/javafx.controls/build/classes/java/main" + modulePath += File.pathSeparator + "${rootProject.projectDir}/modules/javafx.graphics/build/classes/java/main" + modulePath += File.pathSeparator + "${rootProject.projectDir}/modules/javafx.base/build/classes/java/main" + + // FIXME: KCR +// processResources { +// doLast { +// def cssFiles = fileTree(dir: "$moduleDir/com/sun/javafx/scene/control/skin") +// cssFiles.include "**/*.css" +// cssFiles.each { css -> +// logger.info("converting CSS to BSS ${css}"); +// +// javaexec { +// executable = JAVA +// workingDir = project.projectDir +// jvmArgs += patchModuleArgs +// jvmArgs += "--module-path=$modulePath" +// jvmArgs += "--add-modules=javafx.graphics" +// mainClass = "com.sun.javafx.css.parser.Css2Bin" +// args css +// } +// } +// } +// } +// +// def copyShimBssTask = project.task("copyShimBss", type: Copy, +// dependsOn: [project.tasks.getByName("compileJava"), +// project.tasks.getByName("processResources")]) { +// from project.moduleDir +// into project.moduleShimsDir +// include "**/*.bss" +// } +// processShimsResources.dependsOn(copyShimBssTask) + + addMavenPublication(project, [ 'graphics' , 'controls']) + + addValidateSourceSets(project, sourceSets) +} + project(":swing") { // We need to skip setting compiler.options.release for this module, @@ -4240,7 +4321,7 @@ task javadoc(type: Javadoc, dependsOn: createMSPfile) { description = "Generates the JavaDoc for all the public API" executable = JAVADOC def projectsToDocument = [ - project(":base"), project(":graphics"), project(":controls"), project(":media"), + project(":base"), project(":graphics"), project(":controls"), project(":incubator.controls"), project(":media"), project(":swing"), /*project(":swt"),*/ project(":fxml"), project(":web")] source(projectsToDocument.collect({ [it.sourceSets.main.java] @@ -5563,6 +5644,7 @@ compileTargets { t -> def modnames = [] moduleProjList.each { project -> if (project.hasProperty("moduleName") && project.buildModule) { + def incubating = project.hasProperty("incubating") && project.ext.incubating modnames << project.ext.moduleName File dir; if (project.sourceSets.hasProperty('shims')) { @@ -5574,16 +5656,18 @@ compileTargets { t -> def dstModuleDir = cygpath(dir.path) modpath << "${dstModuleDir}" - String themod = dir.toURI() - testJavaPolicyFile << "grant codeBase \"${themod}\" {\n" + - " permission java.security.AllPermission;\n" + - "};\n" - - dir = new File(rootProject.buildDir, "sdk/lib/${project.ext.moduleName}.jar") - themod = dir.toURI() - runJavaPolicyFile << "grant codeBase \"${themod}\" {\n" + - " permission java.security.AllPermission;\n" + - "};\n" + if (!incubating) { + String themod = dir.toURI() + testJavaPolicyFile << "grant codeBase \"${themod}\" {\n" + + " permission java.security.AllPermission;\n" + + "};\n" + + dir = new File(rootProject.buildDir, "sdk/lib/${project.ext.moduleName}.jar") + themod = dir.toURI() + runJavaPolicyFile << "grant codeBase \"${themod}\" {\n" + + " permission java.security.AllPermission;\n" + + "};\n" + } } } @@ -5629,6 +5713,8 @@ compileTargets { t -> def jmodName = "${moduleName}.jmod" def jmodFile = "${jmodsDir}/${jmodName}" + def incubating = project.hasProperty("incubating") && project.ext.incubating + // On Windows, copy the native libraries in the jmod image // to a "javafx" subdir to avoid conflicting with the Microsoft // DLLs that are shipped with the JDK @@ -5672,6 +5758,10 @@ compileTargets { t -> if (sourceDateEpoch != null && status >= 0) { args("--date", extendedTimestamp) } + if (incubating) { + args("--do-not-resolve-by-default") + args("--warn-if-resolved=incubating") + } args(jmodFile) } } diff --git a/modules/javafx.base/src/main/java/module-info.java b/modules/javafx.base/src/main/java/module-info.java index 4a667bc4d76..aeb1f22e8ef 100644 --- a/modules/javafx.base/src/main/java/module-info.java +++ b/modules/javafx.base/src/main/java/module-info.java @@ -47,6 +47,7 @@ exports com.sun.javafx to javafx.controls, + javafx.incubator.controls, javafx.graphics, javafx.fxml, javafx.media, diff --git a/modules/javafx.incubator.controls/src/main/java/com/sun/javafx/incubator/scene/control/MyImpl.java b/modules/javafx.incubator.controls/src/main/java/com/sun/javafx/incubator/scene/control/MyImpl.java new file mode 100644 index 00000000000..9c3450446da --- /dev/null +++ b/modules/javafx.incubator.controls/src/main/java/com/sun/javafx/incubator/scene/control/MyImpl.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2023, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.javafx.incubator.scene.control; + +import javafx.incubator.scene.control.MyButton; +import com.sun.javafx.PlatformUtil; + +/** + * + * @author kcr + */ +public class MyImpl { + private MyImpl() {} + + public static void print(MyButton button) { + System.out.println("isMac: " + PlatformUtil.isMac()); + System.out.println("button: " + button); + } +} diff --git a/modules/javafx.incubator.controls/src/main/java/javafx/incubator/scene/control/MyButton.java b/modules/javafx.incubator.controls/src/main/java/javafx/incubator/scene/control/MyButton.java new file mode 100644 index 00000000000..af95a778d2c --- /dev/null +++ b/modules/javafx.incubator.controls/src/main/java/javafx/incubator/scene/control/MyButton.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2023, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package javafx.incubator.scene.control; + +import com.sun.javafx.incubator.scene.control.MyImpl; +import javafx.scene.control.Button; + +/** + * My experimental control. + * + *
Incubating Feature. + * Will be removed in a future release. + */ +public class MyButton extends Button { + private final int myField; + + public MyButton(int myField, String name) { + super(name); + this.myField = myField; + } + + void print() { + MyImpl.print(this); + } + + // For testing + int getMyField() { + return myField; + } +} diff --git a/modules/javafx.incubator.controls/src/main/java/javafx/incubator/scene/control/package-info.java b/modules/javafx.incubator.controls/src/main/java/javafx/incubator/scene/control/package-info.java new file mode 100644 index 00000000000..4b6a924b987 --- /dev/null +++ b/modules/javafx.incubator.controls/src/main/java/javafx/incubator/scene/control/package-info.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2023, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * Experimental JavaFX controls. + * + *
Incubating Feature. + * Will be removed in a future release. + */ +package javafx.incubator.scene.control; diff --git a/modules/javafx.incubator.controls/src/main/java/module-info.java b/modules/javafx.incubator.controls/src/main/java/module-info.java new file mode 100644 index 00000000000..b948c79442e --- /dev/null +++ b/modules/javafx.incubator.controls/src/main/java/module-info.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2023, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * Experimental UI controls for the JavaFX UI toolkit. + * + *
Incubating Feature. + * Will be removed in a future release. + * + * @moduleGraph + * @since 999 + */ +module javafx.incubator.controls { + requires transitive javafx.base; + requires transitive javafx.graphics; + requires transitive javafx.controls; + + exports javafx.incubator.scene.control; +} diff --git a/modules/javafx.incubator.controls/src/shims/java/javafx/incubator/scene/control/MyButtonShim.java b/modules/javafx.incubator.controls/src/shims/java/javafx/incubator/scene/control/MyButtonShim.java new file mode 100644 index 00000000000..bbd66ce4afe --- /dev/null +++ b/modules/javafx.incubator.controls/src/shims/java/javafx/incubator/scene/control/MyButtonShim.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2023, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package javafx.incubator.scene.control; + +public class MyButtonShim { + public static int getMyField(MyButton myButton) { + return myButton.getMyField(); + } +} diff --git a/modules/javafx.incubator.controls/src/test/addExports b/modules/javafx.incubator.controls/src/test/addExports new file mode 100644 index 00000000000..a67c9ac0929 --- /dev/null +++ b/modules/javafx.incubator.controls/src/test/addExports @@ -0,0 +1,19 @@ +--add-exports javafx.base/com.sun.javafx=ALL-UNNAMED +# +--add-exports javafx.graphics/com.sun.javafx.application=ALL-UNNAMED +--add-exports javafx.graphics/com.sun.javafx.geom=ALL-UNNAMED +--add-exports javafx.graphics/com.sun.javafx.perf=ALL-UNNAMED +--add-exports javafx.graphics/com.sun.javafx.scene.text=ALL-UNNAMED +--add-exports javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED +--add-exports javafx.graphics/com.sun.javafx.stage=ALL-UNNAMED +--add-exports javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED +--add-exports javafx.graphics/com.sun.javafx.util=ALL-UNNAMED +--add-exports javafx.graphics/com.sun.prism=ALL-UNNAMED +--add-exports javafx.graphics/com.sun.scenario.animation=ALL-UNNAMED +# +--add-exports javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED +--add-exports javafx.controls/com.sun.javafx.scene.control.inputmap=ALL-UNNAMED +--add-exports javafx.controls/com.sun.javafx.scene.control.skin=ALL-UNNAMED +--add-exports javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED +# +--add-exports javafx.incubator.controls/com.sun.javafx.incubator.scene.control=ALL-UNNAMED diff --git a/modules/javafx.incubator.controls/src/test/java/test/javafx/incubator/scene/control/MyButtonTest.java b/modules/javafx.incubator.controls/src/test/java/test/javafx/incubator/scene/control/MyButtonTest.java new file mode 100644 index 00000000000..d2912daef49 --- /dev/null +++ b/modules/javafx.incubator.controls/src/test/java/test/javafx/incubator/scene/control/MyButtonTest.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2023, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package test.javafx.incubator.scene.control; + +import com.sun.javafx.incubator.scene.control.MyImpl; +import javafx.incubator.scene.control.MyButton; +import javafx.incubator.scene.control.MyButtonShim; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class MyButtonTest { + @Test + public void myTest() { + MyButton myButton = new MyButton(17, "Hello"); + MyImpl.print(myButton); + + assertEquals("Hello", myButton.getText()); + assertEquals(17, MyButtonShim.getMyField(myButton)); + } +} diff --git a/settings.gradle b/settings.gradle index e372c0e48e9..1a74440494f 100644 --- a/settings.gradle +++ b/settings.gradle @@ -23,11 +23,12 @@ * questions. */ -include "base", "graphics", "controls", "swing", "swt", "fxml", "web", "media", "systemTests" +include "base", "graphics", "controls", "incubator.controls", "swing", "swt", "fxml", "web", "media", "systemTests" project(":base").projectDir = file("modules/javafx.base") project(":graphics").projectDir = file("modules/javafx.graphics") project(":controls").projectDir = file("modules/javafx.controls") +project(":incubator.controls").projectDir = file("modules/javafx.incubator.controls") project(":swing").projectDir = file("modules/javafx.swing") project(":swt").projectDir = file("modules/javafx.swt") project(":fxml").projectDir = file("modules/javafx.fxml") From 75e99c0f6047dcab1355c723d0c2f6aefcaeca2f Mon Sep 17 00:00:00 2001 From: Andy Goryachev Date: Fri, 17 Nov 2023 10:07:18 -0800 Subject: [PATCH 02/30] eclipse config --- modules/javafx.incubator.controls/.classpath | 48 +++++++++++++++++++ modules/javafx.incubator.controls/.project | 17 +++++++ .../org.eclipse.core.resources.prefs | 2 + 3 files changed, 67 insertions(+) create mode 100644 modules/javafx.incubator.controls/.classpath create mode 100644 modules/javafx.incubator.controls/.project create mode 100644 modules/javafx.incubator.controls/.settings/org.eclipse.core.resources.prefs diff --git a/modules/javafx.incubator.controls/.classpath b/modules/javafx.incubator.controls/.classpath new file mode 100644 index 00000000000..97ef473e0c0 --- /dev/null +++ b/modules/javafx.incubator.controls/.classpath @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/javafx.incubator.controls/.project b/modules/javafx.incubator.controls/.project new file mode 100644 index 00000000000..d4edc4d9c4c --- /dev/null +++ b/modules/javafx.incubator.controls/.project @@ -0,0 +1,17 @@ + + + incubator.controls + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/modules/javafx.incubator.controls/.settings/org.eclipse.core.resources.prefs b/modules/javafx.incubator.controls/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000000..99f26c0203a --- /dev/null +++ b/modules/javafx.incubator.controls/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 From 0cb3c6b0fd3d82d9da74d31e2f0038187e130511 Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Tue, 20 Feb 2024 13:22:26 -0800 Subject: [PATCH 03/30] Change module name to javafx.incubator.myfeature --- build.gradle | 9 +++++---- modules/javafx.base/src/main/java/module-info.java | 2 +- .../.classpath | 0 .../.project | 2 +- .../.settings/org.eclipse.core.resources.prefs | 0 .../com/sun/javafx/incubator/scene/control/MyImpl.java | 0 .../java/javafx/incubator/scene/control/MyButton.java | 0 .../javafx/incubator/scene/control/package-info.java | 0 .../src/main/java/module-info.java | 2 +- .../javafx/incubator/scene/control/MyButtonShim.java | 0 .../src/test/addExports | 2 +- .../javafx/incubator/scene/control/MyButtonTest.java | 0 settings.gradle | 4 ++-- 13 files changed, 11 insertions(+), 10 deletions(-) rename modules/{javafx.incubator.controls => javafx.incubator.myfeature}/.classpath (100%) rename modules/{javafx.incubator.controls => javafx.incubator.myfeature}/.project (91%) rename modules/{javafx.incubator.controls => javafx.incubator.myfeature}/.settings/org.eclipse.core.resources.prefs (100%) rename modules/{javafx.incubator.controls => javafx.incubator.myfeature}/src/main/java/com/sun/javafx/incubator/scene/control/MyImpl.java (100%) rename modules/{javafx.incubator.controls => javafx.incubator.myfeature}/src/main/java/javafx/incubator/scene/control/MyButton.java (100%) rename modules/{javafx.incubator.controls => javafx.incubator.myfeature}/src/main/java/javafx/incubator/scene/control/package-info.java (100%) rename modules/{javafx.incubator.controls => javafx.incubator.myfeature}/src/main/java/module-info.java (97%) rename modules/{javafx.incubator.controls => javafx.incubator.myfeature}/src/shims/java/javafx/incubator/scene/control/MyButtonShim.java (100%) rename modules/{javafx.incubator.controls => javafx.incubator.myfeature}/src/test/addExports (91%) rename modules/{javafx.incubator.controls => javafx.incubator.myfeature}/src/test/java/test/javafx/incubator/scene/control/MyButtonTest.java (100%) diff --git a/build.gradle b/build.gradle index a921d89badb..0b0722cb3d2 100644 --- a/build.gradle +++ b/build.gradle @@ -2749,11 +2749,12 @@ project(":controls") { addValidateSourceSets(project, sourceSets) } -project(":incubator.controls") { +// Replace "myfeature" with the name of your feature +project(":incubator.myfeature") { project.ext.buildModule = true project.ext.includeSources = true project.ext.moduleRuntime = true - project.ext.moduleName = "javafx.incubator.controls" + project.ext.moduleName = "javafx.incubator.myfeature" project.ext.incubating = true sourceSets { @@ -2775,7 +2776,7 @@ project(":incubator.controls") { project.ext.moduleSourcePath = defaultModuleSourcePath project.ext.moduleSourcePathShim = defaultModuleSourcePathShim - commonModuleSetup(project, [ 'base', 'graphics', 'controls', 'incubator.controls' ]) + commonModuleSetup(project, [ 'base', 'graphics', 'controls', 'incubator.myfeature' ]) dependencies { testImplementation project(":base").sourceSets.test.output @@ -4321,7 +4322,7 @@ task javadoc(type: Javadoc, dependsOn: createMSPfile) { description = "Generates the JavaDoc for all the public API" executable = JAVADOC def projectsToDocument = [ - project(":base"), project(":graphics"), project(":controls"), project(":incubator.controls"), project(":media"), + project(":base"), project(":graphics"), project(":controls"), project(":incubator.myfeature"), project(":media"), project(":swing"), /*project(":swt"),*/ project(":fxml"), project(":web")] source(projectsToDocument.collect({ [it.sourceSets.main.java] diff --git a/modules/javafx.base/src/main/java/module-info.java b/modules/javafx.base/src/main/java/module-info.java index aeb1f22e8ef..3a38fecb187 100644 --- a/modules/javafx.base/src/main/java/module-info.java +++ b/modules/javafx.base/src/main/java/module-info.java @@ -47,7 +47,7 @@ exports com.sun.javafx to javafx.controls, - javafx.incubator.controls, + javafx.incubator.myfeature, javafx.graphics, javafx.fxml, javafx.media, diff --git a/modules/javafx.incubator.controls/.classpath b/modules/javafx.incubator.myfeature/.classpath similarity index 100% rename from modules/javafx.incubator.controls/.classpath rename to modules/javafx.incubator.myfeature/.classpath diff --git a/modules/javafx.incubator.controls/.project b/modules/javafx.incubator.myfeature/.project similarity index 91% rename from modules/javafx.incubator.controls/.project rename to modules/javafx.incubator.myfeature/.project index d4edc4d9c4c..01eaa0920be 100644 --- a/modules/javafx.incubator.controls/.project +++ b/modules/javafx.incubator.myfeature/.project @@ -1,6 +1,6 @@ - incubator.controls + incubator.myfeature diff --git a/modules/javafx.incubator.controls/.settings/org.eclipse.core.resources.prefs b/modules/javafx.incubator.myfeature/.settings/org.eclipse.core.resources.prefs similarity index 100% rename from modules/javafx.incubator.controls/.settings/org.eclipse.core.resources.prefs rename to modules/javafx.incubator.myfeature/.settings/org.eclipse.core.resources.prefs diff --git a/modules/javafx.incubator.controls/src/main/java/com/sun/javafx/incubator/scene/control/MyImpl.java b/modules/javafx.incubator.myfeature/src/main/java/com/sun/javafx/incubator/scene/control/MyImpl.java similarity index 100% rename from modules/javafx.incubator.controls/src/main/java/com/sun/javafx/incubator/scene/control/MyImpl.java rename to modules/javafx.incubator.myfeature/src/main/java/com/sun/javafx/incubator/scene/control/MyImpl.java diff --git a/modules/javafx.incubator.controls/src/main/java/javafx/incubator/scene/control/MyButton.java b/modules/javafx.incubator.myfeature/src/main/java/javafx/incubator/scene/control/MyButton.java similarity index 100% rename from modules/javafx.incubator.controls/src/main/java/javafx/incubator/scene/control/MyButton.java rename to modules/javafx.incubator.myfeature/src/main/java/javafx/incubator/scene/control/MyButton.java diff --git a/modules/javafx.incubator.controls/src/main/java/javafx/incubator/scene/control/package-info.java b/modules/javafx.incubator.myfeature/src/main/java/javafx/incubator/scene/control/package-info.java similarity index 100% rename from modules/javafx.incubator.controls/src/main/java/javafx/incubator/scene/control/package-info.java rename to modules/javafx.incubator.myfeature/src/main/java/javafx/incubator/scene/control/package-info.java diff --git a/modules/javafx.incubator.controls/src/main/java/module-info.java b/modules/javafx.incubator.myfeature/src/main/java/module-info.java similarity index 97% rename from modules/javafx.incubator.controls/src/main/java/module-info.java rename to modules/javafx.incubator.myfeature/src/main/java/module-info.java index b948c79442e..3c36d45c574 100644 --- a/modules/javafx.incubator.controls/src/main/java/module-info.java +++ b/modules/javafx.incubator.myfeature/src/main/java/module-info.java @@ -32,7 +32,7 @@ * @moduleGraph * @since 999 */ -module javafx.incubator.controls { +module javafx.incubator.myfeature { requires transitive javafx.base; requires transitive javafx.graphics; requires transitive javafx.controls; diff --git a/modules/javafx.incubator.controls/src/shims/java/javafx/incubator/scene/control/MyButtonShim.java b/modules/javafx.incubator.myfeature/src/shims/java/javafx/incubator/scene/control/MyButtonShim.java similarity index 100% rename from modules/javafx.incubator.controls/src/shims/java/javafx/incubator/scene/control/MyButtonShim.java rename to modules/javafx.incubator.myfeature/src/shims/java/javafx/incubator/scene/control/MyButtonShim.java diff --git a/modules/javafx.incubator.controls/src/test/addExports b/modules/javafx.incubator.myfeature/src/test/addExports similarity index 91% rename from modules/javafx.incubator.controls/src/test/addExports rename to modules/javafx.incubator.myfeature/src/test/addExports index a67c9ac0929..6395cc0c886 100644 --- a/modules/javafx.incubator.controls/src/test/addExports +++ b/modules/javafx.incubator.myfeature/src/test/addExports @@ -16,4 +16,4 @@ --add-exports javafx.controls/com.sun.javafx.scene.control.skin=ALL-UNNAMED --add-exports javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED # ---add-exports javafx.incubator.controls/com.sun.javafx.incubator.scene.control=ALL-UNNAMED +--add-exports javafx.incubator.myfeature/com.sun.javafx.incubator.scene.control=ALL-UNNAMED diff --git a/modules/javafx.incubator.controls/src/test/java/test/javafx/incubator/scene/control/MyButtonTest.java b/modules/javafx.incubator.myfeature/src/test/java/test/javafx/incubator/scene/control/MyButtonTest.java similarity index 100% rename from modules/javafx.incubator.controls/src/test/java/test/javafx/incubator/scene/control/MyButtonTest.java rename to modules/javafx.incubator.myfeature/src/test/java/test/javafx/incubator/scene/control/MyButtonTest.java diff --git a/settings.gradle b/settings.gradle index 1a74440494f..6b740bca0f3 100644 --- a/settings.gradle +++ b/settings.gradle @@ -23,12 +23,12 @@ * questions. */ -include "base", "graphics", "controls", "incubator.controls", "swing", "swt", "fxml", "web", "media", "systemTests" +include "base", "graphics", "controls", "incubator.myfeature", "swing", "swt", "fxml", "web", "media", "systemTests" project(":base").projectDir = file("modules/javafx.base") project(":graphics").projectDir = file("modules/javafx.graphics") project(":controls").projectDir = file("modules/javafx.controls") -project(":incubator.controls").projectDir = file("modules/javafx.incubator.controls") +project(":incubator.myfeature").projectDir = file("modules/javafx.incubator.myfeature") project(":swing").projectDir = file("modules/javafx.swing") project(":swt").projectDir = file("modules/javafx.swt") project(":fxml").projectDir = file("modules/javafx.fxml") From 0e6d56ba2487e43ecb36e72d014a73ed0945c4d3 Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Tue, 20 Feb 2024 13:40:39 -0800 Subject: [PATCH 04/30] Rename package to javafx.incubator.scene.mypkg --- .../javafx/incubator/scene/{control => mypkg}/MyImpl.java | 4 ++-- .../incubator/scene/{control => mypkg}/MyButton.java | 4 ++-- .../incubator/scene/{control => mypkg}/package-info.java | 2 +- .../src/main/java/module-info.java | 2 +- .../incubator/scene/{control => mypkg}/MyButtonShim.java | 2 +- modules/javafx.incubator.myfeature/src/test/addExports | 2 +- .../incubator/scene/{control => mypkg}/MyButtonTest.java | 8 ++++---- 7 files changed, 12 insertions(+), 12 deletions(-) rename modules/javafx.incubator.myfeature/src/main/java/com/sun/javafx/incubator/scene/{control => mypkg}/MyImpl.java (93%) rename modules/javafx.incubator.myfeature/src/main/java/javafx/incubator/scene/{control => mypkg}/MyButton.java (94%) rename modules/javafx.incubator.myfeature/src/main/java/javafx/incubator/scene/{control => mypkg}/package-info.java (97%) rename modules/javafx.incubator.myfeature/src/shims/java/javafx/incubator/scene/{control => mypkg}/MyButtonShim.java (97%) rename modules/javafx.incubator.myfeature/src/test/java/test/javafx/incubator/scene/{control => mypkg}/MyButtonTest.java (88%) diff --git a/modules/javafx.incubator.myfeature/src/main/java/com/sun/javafx/incubator/scene/control/MyImpl.java b/modules/javafx.incubator.myfeature/src/main/java/com/sun/javafx/incubator/scene/mypkg/MyImpl.java similarity index 93% rename from modules/javafx.incubator.myfeature/src/main/java/com/sun/javafx/incubator/scene/control/MyImpl.java rename to modules/javafx.incubator.myfeature/src/main/java/com/sun/javafx/incubator/scene/mypkg/MyImpl.java index 9c3450446da..72a543bdb76 100644 --- a/modules/javafx.incubator.myfeature/src/main/java/com/sun/javafx/incubator/scene/control/MyImpl.java +++ b/modules/javafx.incubator.myfeature/src/main/java/com/sun/javafx/incubator/scene/mypkg/MyImpl.java @@ -23,9 +23,9 @@ * questions. */ -package com.sun.javafx.incubator.scene.control; +package com.sun.javafx.incubator.scene.mypkg; -import javafx.incubator.scene.control.MyButton; +import javafx.incubator.scene.mypkg.MyButton; import com.sun.javafx.PlatformUtil; /** diff --git a/modules/javafx.incubator.myfeature/src/main/java/javafx/incubator/scene/control/MyButton.java b/modules/javafx.incubator.myfeature/src/main/java/javafx/incubator/scene/mypkg/MyButton.java similarity index 94% rename from modules/javafx.incubator.myfeature/src/main/java/javafx/incubator/scene/control/MyButton.java rename to modules/javafx.incubator.myfeature/src/main/java/javafx/incubator/scene/mypkg/MyButton.java index af95a778d2c..3267a24da95 100644 --- a/modules/javafx.incubator.myfeature/src/main/java/javafx/incubator/scene/control/MyButton.java +++ b/modules/javafx.incubator.myfeature/src/main/java/javafx/incubator/scene/mypkg/MyButton.java @@ -23,9 +23,9 @@ * questions. */ -package javafx.incubator.scene.control; +package javafx.incubator.scene.mypkg; -import com.sun.javafx.incubator.scene.control.MyImpl; +import com.sun.javafx.incubator.scene.mypkg.MyImpl; import javafx.scene.control.Button; /** diff --git a/modules/javafx.incubator.myfeature/src/main/java/javafx/incubator/scene/control/package-info.java b/modules/javafx.incubator.myfeature/src/main/java/javafx/incubator/scene/mypkg/package-info.java similarity index 97% rename from modules/javafx.incubator.myfeature/src/main/java/javafx/incubator/scene/control/package-info.java rename to modules/javafx.incubator.myfeature/src/main/java/javafx/incubator/scene/mypkg/package-info.java index 4b6a924b987..16ec5810a01 100644 --- a/modules/javafx.incubator.myfeature/src/main/java/javafx/incubator/scene/control/package-info.java +++ b/modules/javafx.incubator.myfeature/src/main/java/javafx/incubator/scene/mypkg/package-info.java @@ -29,4 +29,4 @@ *
Incubating Feature. * Will be removed in a future release. */ -package javafx.incubator.scene.control; +package javafx.incubator.scene.mypkg; diff --git a/modules/javafx.incubator.myfeature/src/main/java/module-info.java b/modules/javafx.incubator.myfeature/src/main/java/module-info.java index 3c36d45c574..4279b03e380 100644 --- a/modules/javafx.incubator.myfeature/src/main/java/module-info.java +++ b/modules/javafx.incubator.myfeature/src/main/java/module-info.java @@ -37,5 +37,5 @@ requires transitive javafx.graphics; requires transitive javafx.controls; - exports javafx.incubator.scene.control; + exports javafx.incubator.scene.mypkg; } diff --git a/modules/javafx.incubator.myfeature/src/shims/java/javafx/incubator/scene/control/MyButtonShim.java b/modules/javafx.incubator.myfeature/src/shims/java/javafx/incubator/scene/mypkg/MyButtonShim.java similarity index 97% rename from modules/javafx.incubator.myfeature/src/shims/java/javafx/incubator/scene/control/MyButtonShim.java rename to modules/javafx.incubator.myfeature/src/shims/java/javafx/incubator/scene/mypkg/MyButtonShim.java index bbd66ce4afe..5da094cc499 100644 --- a/modules/javafx.incubator.myfeature/src/shims/java/javafx/incubator/scene/control/MyButtonShim.java +++ b/modules/javafx.incubator.myfeature/src/shims/java/javafx/incubator/scene/mypkg/MyButtonShim.java @@ -23,7 +23,7 @@ * questions. */ -package javafx.incubator.scene.control; +package javafx.incubator.scene.mypkg; public class MyButtonShim { public static int getMyField(MyButton myButton) { diff --git a/modules/javafx.incubator.myfeature/src/test/addExports b/modules/javafx.incubator.myfeature/src/test/addExports index 6395cc0c886..489636421eb 100644 --- a/modules/javafx.incubator.myfeature/src/test/addExports +++ b/modules/javafx.incubator.myfeature/src/test/addExports @@ -16,4 +16,4 @@ --add-exports javafx.controls/com.sun.javafx.scene.control.skin=ALL-UNNAMED --add-exports javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED # ---add-exports javafx.incubator.myfeature/com.sun.javafx.incubator.scene.control=ALL-UNNAMED +--add-exports javafx.incubator.myfeature/com.sun.javafx.incubator.scene.mypkg=ALL-UNNAMED diff --git a/modules/javafx.incubator.myfeature/src/test/java/test/javafx/incubator/scene/control/MyButtonTest.java b/modules/javafx.incubator.myfeature/src/test/java/test/javafx/incubator/scene/mypkg/MyButtonTest.java similarity index 88% rename from modules/javafx.incubator.myfeature/src/test/java/test/javafx/incubator/scene/control/MyButtonTest.java rename to modules/javafx.incubator.myfeature/src/test/java/test/javafx/incubator/scene/mypkg/MyButtonTest.java index d2912daef49..d33daa2a6d6 100644 --- a/modules/javafx.incubator.myfeature/src/test/java/test/javafx/incubator/scene/control/MyButtonTest.java +++ b/modules/javafx.incubator.myfeature/src/test/java/test/javafx/incubator/scene/mypkg/MyButtonTest.java @@ -23,11 +23,11 @@ * questions. */ -package test.javafx.incubator.scene.control; +package test.javafx.incubator.scene.mypkg; -import com.sun.javafx.incubator.scene.control.MyImpl; -import javafx.incubator.scene.control.MyButton; -import javafx.incubator.scene.control.MyButtonShim; +import com.sun.javafx.incubator.scene.mypkg.MyImpl; +import javafx.incubator.scene.mypkg.MyButton; +import javafx.incubator.scene.mypkg.MyButtonShim; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; From cd639799091d67d77b4d0f9552a6719d4c2cca8e Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Tue, 20 Feb 2024 15:17:15 -0800 Subject: [PATCH 05/30] Create INCUBATOR-MODULES.md doc --- INCUBATOR-MODULES.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 INCUBATOR-MODULES.md diff --git a/INCUBATOR-MODULES.md b/INCUBATOR-MODULES.md new file mode 100644 index 00000000000..79c51a6ca3c --- /dev/null +++ b/INCUBATOR-MODULES.md @@ -0,0 +1,28 @@ +# JavaFX Incubator Modules + +## Overview + +In [JEP 11](https://openjdk.org/jeps/11), the JDK provides incubator modules as a means of putting non-final API in the hands of developers, while the API progresses towards either finalization or removal in a future release. + +Similarly, some JavaFX APIs would benefit from spending a period of time in a JavaFX release prior to being deemed stable. Being in the mainline `jfx` repository, and thus in downstream binaries such as those at jdk.java.net, makes it easier for interested parties outside of the immediate OpenJDK Community to use the new feature. Experience gained and fed back through the usual channels such as blogs, mailing lists, outreach programs, and conferences can then be acted upon before finalizing, or else removing, the feature in a future release. + +This is especially useful for complex features with a large API surface. Such features are nearly impossible to get right the first time, even after an extensive review. Using an incubator module will allow the API to evolve in future releases without the strict compatibility constraints that core JavaFX modules have. + +## Description + +An incubating feature is an API of non-trivial size, that is under development for eventual inclusion in the core set of JavaFX APIs. The API is not yet sufficiently proven, so it is desirable to defer finalization for a small number of feature releases in order to gain additional experience and feedback. + +See [JEP 11](https://openjdk.org/jeps/11) for a description of incubator modules. + +JavaFX incubator modules have a few differences from JDK incubator modules: + +- A JavaFX incubator module is identified by the `javafx.incubator.` prefix in its module name. +- A JavaFX incubating API is identified by the `javafx.incubator.` prefix in its exported package names. An incubating API is exported only by an incubator module. +- A warning must be issued when first loading a class from a publicly exported package in a JavaFX incubator module, even if the module is not jlinked into the JDK. We will provide a utility method in `javafx.base` to faciliate this. +- By default, a JavaFX feature that is delivered in an incubator module will re-incubate in subsequent versions (the default in the JDK is to drop the feature). If any changes are needed to the API, they will be done with new JBS enhancement along with an associated CSR. However, this is not intended to suggest the possibility of a permantently incubating feature. As with incubating features in the JDK, if an incubating API is not promoted to final status after a reaonably small number of JavaFX feature releases, then it will be dropped: its packages and incubator module will be removed. + +## How to add a new incubator modules + +In addition to creating the new modules under `modules/javafx.incubator.myfeature`, you need to udpate `build.gradle` and `settings.gradle` to add the new module. + +FIXME: finish this From 0966c552500ff59dfeb9cd207b9717734e6a1912 Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Wed, 21 Feb 2024 06:47:56 -0800 Subject: [PATCH 06/30] Fix typos --- INCUBATOR-MODULES.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/INCUBATOR-MODULES.md b/INCUBATOR-MODULES.md index 79c51a6ca3c..9046541f0e3 100644 --- a/INCUBATOR-MODULES.md +++ b/INCUBATOR-MODULES.md @@ -18,11 +18,11 @@ JavaFX incubator modules have a few differences from JDK incubator modules: - A JavaFX incubator module is identified by the `javafx.incubator.` prefix in its module name. - A JavaFX incubating API is identified by the `javafx.incubator.` prefix in its exported package names. An incubating API is exported only by an incubator module. -- A warning must be issued when first loading a class from a publicly exported package in a JavaFX incubator module, even if the module is not jlinked into the JDK. We will provide a utility method in `javafx.base` to faciliate this. -- By default, a JavaFX feature that is delivered in an incubator module will re-incubate in subsequent versions (the default in the JDK is to drop the feature). If any changes are needed to the API, they will be done with new JBS enhancement along with an associated CSR. However, this is not intended to suggest the possibility of a permantently incubating feature. As with incubating features in the JDK, if an incubating API is not promoted to final status after a reaonably small number of JavaFX feature releases, then it will be dropped: its packages and incubator module will be removed. +- A warning must be issued when first loading a class from a publicly exported package in a JavaFX incubator module, even if the module is not jlinked into the JDK. We will provide a utility method in `javafx.base` to facilitate this. +- By default, a JavaFX feature that is delivered in an incubator module will re-incubate in subsequent versions (the default in the JDK is to drop the feature). If any changes are needed to the API, they will be done with new JBS enhancement along with an associated CSR. However, this is not intended to suggest the possibility of a permanently incubating feature. As with incubating features in the JDK, if an incubating API is not promoted to final status after a reasonably small number of JavaFX feature releases, then it will be dropped: its packages and incubator module will be removed. ## How to add a new incubator modules -In addition to creating the new modules under `modules/javafx.incubator.myfeature`, you need to udpate `build.gradle` and `settings.gradle` to add the new module. +In addition to creating the new modules under `modules/javafx.incubator.myfeature`, you need to update `build.gradle` and `settings.gradle` to add the new module. FIXME: finish this From 02a0b49e5f6da7f9a064ec4f341b6103d8d5e95b Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Thu, 22 Feb 2024 11:12:13 -0800 Subject: [PATCH 07/30] Change javafx.incubator to jfx.incubator --- INCUBATOR-MODULES.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/INCUBATOR-MODULES.md b/INCUBATOR-MODULES.md index 9046541f0e3..0f135e2e397 100644 --- a/INCUBATOR-MODULES.md +++ b/INCUBATOR-MODULES.md @@ -16,13 +16,17 @@ See [JEP 11](https://openjdk.org/jeps/11) for a description of incubator module JavaFX incubator modules have a few differences from JDK incubator modules: -- A JavaFX incubator module is identified by the `javafx.incubator.` prefix in its module name. -- A JavaFX incubating API is identified by the `javafx.incubator.` prefix in its exported package names. An incubating API is exported only by an incubator module. +- A JavaFX incubator module is identified by the `jfx.incubator.` prefix in its module name. +- A JavaFX incubating API is identified by the `jfx.incubator.` prefix in its exported package names. An incubating API is exported only by an incubator module. +- Incubator modules must export incubating APIs only, i.e., packages in the `jfx.incubator` namespace. Consequently: + - JavaFX incubator modules must not export core JavaFX APIs in the `javafx.` namespace. This distinguishes incubator modules from core modules such as `javafx.base`. + - JavaFX non-incubator modules must not specify `requires transitive` dependences upon incubator modules, or otherwise expose types exported from incubator modules in their own exported APIs. In exceptional cases, it may be acceptable for non-incubator modules to specify `requires` dependences (as opposed to `requires transitive`) upon incubator modules. + - JavaFX incubator modules can specify requires or requires transitive dependences upon other incubator modules. - A warning must be issued when first loading a class from a publicly exported package in a JavaFX incubator module, even if the module is not jlinked into the JDK. We will provide a utility method in `javafx.base` to facilitate this. - By default, a JavaFX feature that is delivered in an incubator module will re-incubate in subsequent versions (the default in the JDK is to drop the feature). If any changes are needed to the API, they will be done with new JBS enhancement along with an associated CSR. However, this is not intended to suggest the possibility of a permanently incubating feature. As with incubating features in the JDK, if an incubating API is not promoted to final status after a reasonably small number of JavaFX feature releases, then it will be dropped: its packages and incubator module will be removed. ## How to add a new incubator modules -In addition to creating the new modules under `modules/javafx.incubator.myfeature`, you need to update `build.gradle` and `settings.gradle` to add the new module. +In addition to creating the new modules under `modules/jfx.incubator.myfeature`, you need to update `build.gradle` and `settings.gradle` to add the new module. FIXME: finish this From ee76f0953fc5e205969cc28ce3bf20546eebed62 Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Thu, 22 Feb 2024 12:47:07 -0800 Subject: [PATCH 08/30] Say that a JEP is needed to finalize or drop an incubating feature --- INCUBATOR-MODULES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/INCUBATOR-MODULES.md b/INCUBATOR-MODULES.md index 0f135e2e397..b35a92d781c 100644 --- a/INCUBATOR-MODULES.md +++ b/INCUBATOR-MODULES.md @@ -23,6 +23,7 @@ JavaFX incubator modules have a few differences from JDK incubator modules: - JavaFX non-incubator modules must not specify `requires transitive` dependences upon incubator modules, or otherwise expose types exported from incubator modules in their own exported APIs. In exceptional cases, it may be acceptable for non-incubator modules to specify `requires` dependences (as opposed to `requires transitive`) upon incubator modules. - JavaFX incubator modules can specify requires or requires transitive dependences upon other incubator modules. - A warning must be issued when first loading a class from a publicly exported package in a JavaFX incubator module, even if the module is not jlinked into the JDK. We will provide a utility method in `javafx.base` to facilitate this. +- To either make a JavaFX incubating API final, or to remove it, a new JEP should be submitted, referencing the original incubator JEP. - By default, a JavaFX feature that is delivered in an incubator module will re-incubate in subsequent versions (the default in the JDK is to drop the feature). If any changes are needed to the API, they will be done with new JBS enhancement along with an associated CSR. However, this is not intended to suggest the possibility of a permanently incubating feature. As with incubating features in the JDK, if an incubating API is not promoted to final status after a reasonably small number of JavaFX feature releases, then it will be dropped: its packages and incubator module will be removed. ## How to add a new incubator modules From a61f3954fda5d0c7d6dc5f8dd5eb417f4cd1ae24 Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Fri, 23 Feb 2024 05:03:57 -0800 Subject: [PATCH 09/30] Clarify that a feature should not incubate indefinitely --- INCUBATOR-MODULES.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/INCUBATOR-MODULES.md b/INCUBATOR-MODULES.md index b35a92d781c..3a17e327d97 100644 --- a/INCUBATOR-MODULES.md +++ b/INCUBATOR-MODULES.md @@ -24,7 +24,10 @@ JavaFX incubator modules have a few differences from JDK incubator modules: - JavaFX incubator modules can specify requires or requires transitive dependences upon other incubator modules. - A warning must be issued when first loading a class from a publicly exported package in a JavaFX incubator module, even if the module is not jlinked into the JDK. We will provide a utility method in `javafx.base` to facilitate this. - To either make a JavaFX incubating API final, or to remove it, a new JEP should be submitted, referencing the original incubator JEP. -- By default, a JavaFX feature that is delivered in an incubator module will re-incubate in subsequent versions (the default in the JDK is to drop the feature). If any changes are needed to the API, they will be done with new JBS enhancement along with an associated CSR. However, this is not intended to suggest the possibility of a permanently incubating feature. As with incubating features in the JDK, if an incubating API is not promoted to final status after a reasonably small number of JavaFX feature releases, then it will be dropped: its packages and incubator module will be removed. +- By default, a JavaFX feature that is delivered in an incubator module will re-incubate in subsequent versions (the default in the JDK is to drop the feature). If any changes are needed to the API, they will be done with new JBS enhancement along with an associated CSR. However, this is not intended to suggest the possibility of a permanently incubating feature. As with incubating features in the JDK, if an incubating API is not promoted to final status after a reasonably small number of JavaFX feature releases, then it will be dropped: its packages and incubator module will be removed. As a guideline: + - An incubating API that was not updated in the current shipping feature release and has not been updated in the feature release being developed, is either stable or is not being actively developed. Such an API should either be finalized or dropped. + - An incubating API that spans beyond a 24-month period (4 feature releases), and is not yet ready to be finalized, will need explicit approval from a Project Lead to remain incubating for some additional period at the discretion of a Project Lead. Otherwise, a Project Lead will submit a removal JEP. + - The submitter of the original JEP can propose to remove it at any time. ## How to add a new incubator modules From acfecc293d8bc25f8f36cd1c8d9ab1ab37733d15 Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Fri, 23 Feb 2024 07:06:02 -0800 Subject: [PATCH 10/30] Change module name to jfx.incubator.myfeature --- build.gradle | 49 ++++++++++++++++--- .../src/main/java/module-info.java | 3 +- .../.classpath | 0 .../.project | 0 .../org.eclipse.core.resources.prefs | 0 .../javafx/incubator/scene/mypkg/MyImpl.java | 0 .../incubator/scene/mypkg/MyButton.java | 0 .../incubator/scene/mypkg/package-info.java | 0 .../src/main/java/module-info.java | 2 +- .../incubator/scene/mypkg/MyButtonShim.java | 0 .../src/test/addExports | 2 +- .../incubator/scene/mypkg/MyButtonTest.java | 0 settings.gradle | 16 +++++- 13 files changed, 60 insertions(+), 12 deletions(-) rename modules/{javafx.incubator.myfeature => jfx.incubator.myfeature}/.classpath (100%) rename modules/{javafx.incubator.myfeature => jfx.incubator.myfeature}/.project (100%) rename modules/{javafx.incubator.myfeature => jfx.incubator.myfeature}/.settings/org.eclipse.core.resources.prefs (100%) rename modules/{javafx.incubator.myfeature => jfx.incubator.myfeature}/src/main/java/com/sun/javafx/incubator/scene/mypkg/MyImpl.java (100%) rename modules/{javafx.incubator.myfeature => jfx.incubator.myfeature}/src/main/java/javafx/incubator/scene/mypkg/MyButton.java (100%) rename modules/{javafx.incubator.myfeature => jfx.incubator.myfeature}/src/main/java/javafx/incubator/scene/mypkg/package-info.java (100%) rename modules/{javafx.incubator.myfeature => jfx.incubator.myfeature}/src/main/java/module-info.java (97%) rename modules/{javafx.incubator.myfeature => jfx.incubator.myfeature}/src/shims/java/javafx/incubator/scene/mypkg/MyButtonShim.java (100%) rename modules/{javafx.incubator.myfeature => jfx.incubator.myfeature}/src/test/addExports (91%) rename modules/{javafx.incubator.myfeature => jfx.incubator.myfeature}/src/test/java/test/javafx/incubator/scene/mypkg/MyButtonTest.java (100%) diff --git a/build.gradle b/build.gradle index d03c96b12e3..f95e4db0582 100644 --- a/build.gradle +++ b/build.gradle @@ -939,7 +939,11 @@ List computeLibraryPath(boolean working) { def modulesLibsDir = "${bundledSdkDir}/modules_libs" modsWithNative.each() { m -> - lp << cygpath("${modulesLibsDir}/javafx.${m}") + // TODO: incubator dependency + if (m.hasProperty("moduleName")) { + def moduleName = m.ext.moduleName + lp << cygpath("${modulesLibsDir}/${moduleName}") + } } } else { def platformPrefix = "" @@ -1673,6 +1677,16 @@ void addMavenPublication(Project project, List projectDependencies) { return } + // TODO: incubator dependency + if (!m.hasProperty("moduleName")) { + fail("Project ${m} has no module name") + } + projectDependencies.each { dep -> + if (!dep.hasProperty("moduleName")) { + fail("Project ${m} dependency ${dep} has no module name") + } + } + project.apply plugin: 'maven-publish' project.group = MAVEN_GROUP_ID @@ -1723,7 +1737,9 @@ void addMavenPublication(Project project, List projectDependencies) { project.publishing { publications { maven(MavenPublication) { - artifactId = "javafx-${project.name}" + // TODO: incubator dependency + def artifactName = project.moduleName.replace('.', '-') + artifactId = artifactName afterEvaluate { artifact project.tasks."moduleEmptyPublicationJar$t.capital" @@ -1742,15 +1758,19 @@ void addMavenPublication(Project project, List projectDependencies) { Node projectDependencyPlatform = dependencies.appendNode("dependency") projectDependencyPlatform.appendNode("groupId", MAVEN_GROUP_ID) - projectDependencyPlatform.appendNode("artifactId", "javafx-${project.name}") + // TODO: incubator dependency + projectDependencyPlatform.appendNode("artifactId", artifactName) projectDependencyPlatform.appendNode("version", MAVEN_VERSION) projectDependencyPlatform.appendNode("classifier", "\${javafx.platform}") if (!projectDependencies.empty) { projectDependencies.each { dep -> + // TODO: incubator dependency + def depName = dep.moduleName.replace('.', '-') Node projectDependency = dependencies.appendNode("dependency") projectDependency.appendNode("groupId", MAVEN_GROUP_ID) - projectDependency.appendNode("artifactId", "javafx-$dep") + // TODO: incubator dependency + projectDependency.appendNode("artifactId", depName) projectDependency.appendNode("version", MAVEN_VERSION) } } @@ -2749,12 +2769,13 @@ project(":controls") { addValidateSourceSets(project, sourceSets) } +// TODO: incubator template // Replace "myfeature" with the name of your feature project(":incubator.myfeature") { project.ext.buildModule = true project.ext.includeSources = true project.ext.moduleRuntime = true - project.ext.moduleName = "javafx.incubator.myfeature" + project.ext.moduleName = "jfx.incubator.myfeature" project.ext.incubating = true sourceSets { @@ -4321,9 +4342,19 @@ task javadoc(type: Javadoc, dependsOn: createMSPfile) { group = "Basic" description = "Generates the JavaDoc for all the public API" executable = JAVADOC + // TODO: incubator dependency def projectsToDocument = [ - project(":base"), project(":graphics"), project(":controls"), project(":incubator.myfeature"), project(":media"), - project(":swing"), /*project(":swt"),*/ project(":fxml"), project(":web")] + project(":base"), + project(":graphics"), + project(":controls"), + // TODO: incubator template + project(":incubator.myfeature"), + project(":media"), + project(":swing"), + /*project(":swt"),*/ + project(":fxml"), + project(":web") + ] source(projectsToDocument.collect({ [it.sourceSets.main.java] })); @@ -5645,6 +5676,7 @@ compileTargets { t -> def modnames = [] moduleProjList.each { project -> if (project.hasProperty("moduleName") && project.buildModule) { + // TODO: incubator dependency def incubating = project.hasProperty("incubating") && project.ext.incubating modnames << project.ext.moduleName File dir; @@ -5657,6 +5689,7 @@ compileTargets { t -> def dstModuleDir = cygpath(dir.path) modpath << "${dstModuleDir}" + // TODO: incubator dependency if (!incubating) { String themod = dir.toURI() testJavaPolicyFile << "grant codeBase \"${themod}\" {\n" + @@ -5714,6 +5747,7 @@ compileTargets { t -> def jmodName = "${moduleName}.jmod" def jmodFile = "${jmodsDir}/${jmodName}" + // TODO: incubator dependency def incubating = project.hasProperty("incubating") && project.ext.incubating // On Windows, copy the native libraries in the jmod image @@ -5757,6 +5791,7 @@ compileTargets { t -> if (sourceDateEpoch != null) { args("--date", extendedTimestamp) } + // TODO: incubator dependency if (incubating) { args("--do-not-resolve-by-default") args("--warn-if-resolved=incubating") diff --git a/modules/javafx.base/src/main/java/module-info.java b/modules/javafx.base/src/main/java/module-info.java index 3a38fecb187..0f0b07f4fdc 100644 --- a/modules/javafx.base/src/main/java/module-info.java +++ b/modules/javafx.base/src/main/java/module-info.java @@ -47,7 +47,8 @@ exports com.sun.javafx to javafx.controls, - javafx.incubator.myfeature, + // TODO: incubator template + jfx.incubator.myfeature, javafx.graphics, javafx.fxml, javafx.media, diff --git a/modules/javafx.incubator.myfeature/.classpath b/modules/jfx.incubator.myfeature/.classpath similarity index 100% rename from modules/javafx.incubator.myfeature/.classpath rename to modules/jfx.incubator.myfeature/.classpath diff --git a/modules/javafx.incubator.myfeature/.project b/modules/jfx.incubator.myfeature/.project similarity index 100% rename from modules/javafx.incubator.myfeature/.project rename to modules/jfx.incubator.myfeature/.project diff --git a/modules/javafx.incubator.myfeature/.settings/org.eclipse.core.resources.prefs b/modules/jfx.incubator.myfeature/.settings/org.eclipse.core.resources.prefs similarity index 100% rename from modules/javafx.incubator.myfeature/.settings/org.eclipse.core.resources.prefs rename to modules/jfx.incubator.myfeature/.settings/org.eclipse.core.resources.prefs diff --git a/modules/javafx.incubator.myfeature/src/main/java/com/sun/javafx/incubator/scene/mypkg/MyImpl.java b/modules/jfx.incubator.myfeature/src/main/java/com/sun/javafx/incubator/scene/mypkg/MyImpl.java similarity index 100% rename from modules/javafx.incubator.myfeature/src/main/java/com/sun/javafx/incubator/scene/mypkg/MyImpl.java rename to modules/jfx.incubator.myfeature/src/main/java/com/sun/javafx/incubator/scene/mypkg/MyImpl.java diff --git a/modules/javafx.incubator.myfeature/src/main/java/javafx/incubator/scene/mypkg/MyButton.java b/modules/jfx.incubator.myfeature/src/main/java/javafx/incubator/scene/mypkg/MyButton.java similarity index 100% rename from modules/javafx.incubator.myfeature/src/main/java/javafx/incubator/scene/mypkg/MyButton.java rename to modules/jfx.incubator.myfeature/src/main/java/javafx/incubator/scene/mypkg/MyButton.java diff --git a/modules/javafx.incubator.myfeature/src/main/java/javafx/incubator/scene/mypkg/package-info.java b/modules/jfx.incubator.myfeature/src/main/java/javafx/incubator/scene/mypkg/package-info.java similarity index 100% rename from modules/javafx.incubator.myfeature/src/main/java/javafx/incubator/scene/mypkg/package-info.java rename to modules/jfx.incubator.myfeature/src/main/java/javafx/incubator/scene/mypkg/package-info.java diff --git a/modules/javafx.incubator.myfeature/src/main/java/module-info.java b/modules/jfx.incubator.myfeature/src/main/java/module-info.java similarity index 97% rename from modules/javafx.incubator.myfeature/src/main/java/module-info.java rename to modules/jfx.incubator.myfeature/src/main/java/module-info.java index 4279b03e380..c3c935b29e4 100644 --- a/modules/javafx.incubator.myfeature/src/main/java/module-info.java +++ b/modules/jfx.incubator.myfeature/src/main/java/module-info.java @@ -32,7 +32,7 @@ * @moduleGraph * @since 999 */ -module javafx.incubator.myfeature { +module jfx.incubator.myfeature { requires transitive javafx.base; requires transitive javafx.graphics; requires transitive javafx.controls; diff --git a/modules/javafx.incubator.myfeature/src/shims/java/javafx/incubator/scene/mypkg/MyButtonShim.java b/modules/jfx.incubator.myfeature/src/shims/java/javafx/incubator/scene/mypkg/MyButtonShim.java similarity index 100% rename from modules/javafx.incubator.myfeature/src/shims/java/javafx/incubator/scene/mypkg/MyButtonShim.java rename to modules/jfx.incubator.myfeature/src/shims/java/javafx/incubator/scene/mypkg/MyButtonShim.java diff --git a/modules/javafx.incubator.myfeature/src/test/addExports b/modules/jfx.incubator.myfeature/src/test/addExports similarity index 91% rename from modules/javafx.incubator.myfeature/src/test/addExports rename to modules/jfx.incubator.myfeature/src/test/addExports index 489636421eb..04454094b3e 100644 --- a/modules/javafx.incubator.myfeature/src/test/addExports +++ b/modules/jfx.incubator.myfeature/src/test/addExports @@ -16,4 +16,4 @@ --add-exports javafx.controls/com.sun.javafx.scene.control.skin=ALL-UNNAMED --add-exports javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED # ---add-exports javafx.incubator.myfeature/com.sun.javafx.incubator.scene.mypkg=ALL-UNNAMED +--add-exports jfx.incubator.myfeature/com.sun.javafx.incubator.scene.mypkg=ALL-UNNAMED diff --git a/modules/javafx.incubator.myfeature/src/test/java/test/javafx/incubator/scene/mypkg/MyButtonTest.java b/modules/jfx.incubator.myfeature/src/test/java/test/javafx/incubator/scene/mypkg/MyButtonTest.java similarity index 100% rename from modules/javafx.incubator.myfeature/src/test/java/test/javafx/incubator/scene/mypkg/MyButtonTest.java rename to modules/jfx.incubator.myfeature/src/test/java/test/javafx/incubator/scene/mypkg/MyButtonTest.java diff --git a/settings.gradle b/settings.gradle index 6b740bca0f3..11bb301d512 100644 --- a/settings.gradle +++ b/settings.gradle @@ -23,12 +23,24 @@ * questions. */ -include "base", "graphics", "controls", "incubator.myfeature", "swing", "swt", "fxml", "web", "media", "systemTests" +// TODO: incubator dependency +include "base", + "graphics", + "controls", + // TODO: incubator template + "incubator.myfeature", + "swing", + "swt", + "fxml", + "web", + "media", + "systemTests" project(":base").projectDir = file("modules/javafx.base") project(":graphics").projectDir = file("modules/javafx.graphics") project(":controls").projectDir = file("modules/javafx.controls") -project(":incubator.myfeature").projectDir = file("modules/javafx.incubator.myfeature") +// TODO: incubator template +project(":incubator.myfeature").projectDir = file("modules/jfx.incubator.myfeature") project(":swing").projectDir = file("modules/javafx.swing") project(":swt").projectDir = file("modules/javafx.swt") project(":fxml").projectDir = file("modules/javafx.fxml") From 136776ca24ce23064201eb99166a9ee79baaf493 Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Fri, 23 Feb 2024 07:21:26 -0800 Subject: [PATCH 11/30] Rename package to jfx.incubator.scene.mypkg --- .../java/com/sun/javafx/incubator/scene/mypkg/MyImpl.java | 2 +- .../{javafx => jfx}/incubator/scene/mypkg/MyButton.java | 2 +- .../{javafx => jfx}/incubator/scene/mypkg/package-info.java | 2 +- .../jfx.incubator.myfeature/src/main/java/module-info.java | 2 +- .../{javafx => jfx}/incubator/scene/mypkg/MyButtonShim.java | 2 +- .../{javafx => jfx}/incubator/scene/mypkg/MyButtonTest.java | 6 +++--- 6 files changed, 8 insertions(+), 8 deletions(-) rename modules/jfx.incubator.myfeature/src/main/java/{javafx => jfx}/incubator/scene/mypkg/MyButton.java (97%) rename modules/jfx.incubator.myfeature/src/main/java/{javafx => jfx}/incubator/scene/mypkg/package-info.java (97%) rename modules/jfx.incubator.myfeature/src/shims/java/{javafx => jfx}/incubator/scene/mypkg/MyButtonShim.java (97%) rename modules/jfx.incubator.myfeature/src/test/java/test/{javafx => jfx}/incubator/scene/mypkg/MyButtonTest.java (92%) diff --git a/modules/jfx.incubator.myfeature/src/main/java/com/sun/javafx/incubator/scene/mypkg/MyImpl.java b/modules/jfx.incubator.myfeature/src/main/java/com/sun/javafx/incubator/scene/mypkg/MyImpl.java index 72a543bdb76..aa3ddca1e84 100644 --- a/modules/jfx.incubator.myfeature/src/main/java/com/sun/javafx/incubator/scene/mypkg/MyImpl.java +++ b/modules/jfx.incubator.myfeature/src/main/java/com/sun/javafx/incubator/scene/mypkg/MyImpl.java @@ -25,7 +25,7 @@ package com.sun.javafx.incubator.scene.mypkg; -import javafx.incubator.scene.mypkg.MyButton; +import jfx.incubator.scene.mypkg.MyButton; import com.sun.javafx.PlatformUtil; /** diff --git a/modules/jfx.incubator.myfeature/src/main/java/javafx/incubator/scene/mypkg/MyButton.java b/modules/jfx.incubator.myfeature/src/main/java/jfx/incubator/scene/mypkg/MyButton.java similarity index 97% rename from modules/jfx.incubator.myfeature/src/main/java/javafx/incubator/scene/mypkg/MyButton.java rename to modules/jfx.incubator.myfeature/src/main/java/jfx/incubator/scene/mypkg/MyButton.java index 3267a24da95..8b226121a1f 100644 --- a/modules/jfx.incubator.myfeature/src/main/java/javafx/incubator/scene/mypkg/MyButton.java +++ b/modules/jfx.incubator.myfeature/src/main/java/jfx/incubator/scene/mypkg/MyButton.java @@ -23,7 +23,7 @@ * questions. */ -package javafx.incubator.scene.mypkg; +package jfx.incubator.scene.mypkg; import com.sun.javafx.incubator.scene.mypkg.MyImpl; import javafx.scene.control.Button; diff --git a/modules/jfx.incubator.myfeature/src/main/java/javafx/incubator/scene/mypkg/package-info.java b/modules/jfx.incubator.myfeature/src/main/java/jfx/incubator/scene/mypkg/package-info.java similarity index 97% rename from modules/jfx.incubator.myfeature/src/main/java/javafx/incubator/scene/mypkg/package-info.java rename to modules/jfx.incubator.myfeature/src/main/java/jfx/incubator/scene/mypkg/package-info.java index 16ec5810a01..4c5983d936d 100644 --- a/modules/jfx.incubator.myfeature/src/main/java/javafx/incubator/scene/mypkg/package-info.java +++ b/modules/jfx.incubator.myfeature/src/main/java/jfx/incubator/scene/mypkg/package-info.java @@ -29,4 +29,4 @@ *
Incubating Feature. * Will be removed in a future release. */ -package javafx.incubator.scene.mypkg; +package jfx.incubator.scene.mypkg; diff --git a/modules/jfx.incubator.myfeature/src/main/java/module-info.java b/modules/jfx.incubator.myfeature/src/main/java/module-info.java index c3c935b29e4..339789a1a4e 100644 --- a/modules/jfx.incubator.myfeature/src/main/java/module-info.java +++ b/modules/jfx.incubator.myfeature/src/main/java/module-info.java @@ -37,5 +37,5 @@ requires transitive javafx.graphics; requires transitive javafx.controls; - exports javafx.incubator.scene.mypkg; + exports jfx.incubator.scene.mypkg; } diff --git a/modules/jfx.incubator.myfeature/src/shims/java/javafx/incubator/scene/mypkg/MyButtonShim.java b/modules/jfx.incubator.myfeature/src/shims/java/jfx/incubator/scene/mypkg/MyButtonShim.java similarity index 97% rename from modules/jfx.incubator.myfeature/src/shims/java/javafx/incubator/scene/mypkg/MyButtonShim.java rename to modules/jfx.incubator.myfeature/src/shims/java/jfx/incubator/scene/mypkg/MyButtonShim.java index 5da094cc499..653e01c55d9 100644 --- a/modules/jfx.incubator.myfeature/src/shims/java/javafx/incubator/scene/mypkg/MyButtonShim.java +++ b/modules/jfx.incubator.myfeature/src/shims/java/jfx/incubator/scene/mypkg/MyButtonShim.java @@ -23,7 +23,7 @@ * questions. */ -package javafx.incubator.scene.mypkg; +package jfx.incubator.scene.mypkg; public class MyButtonShim { public static int getMyField(MyButton myButton) { diff --git a/modules/jfx.incubator.myfeature/src/test/java/test/javafx/incubator/scene/mypkg/MyButtonTest.java b/modules/jfx.incubator.myfeature/src/test/java/test/jfx/incubator/scene/mypkg/MyButtonTest.java similarity index 92% rename from modules/jfx.incubator.myfeature/src/test/java/test/javafx/incubator/scene/mypkg/MyButtonTest.java rename to modules/jfx.incubator.myfeature/src/test/java/test/jfx/incubator/scene/mypkg/MyButtonTest.java index d33daa2a6d6..055b1b253e8 100644 --- a/modules/jfx.incubator.myfeature/src/test/java/test/javafx/incubator/scene/mypkg/MyButtonTest.java +++ b/modules/jfx.incubator.myfeature/src/test/java/test/jfx/incubator/scene/mypkg/MyButtonTest.java @@ -23,11 +23,11 @@ * questions. */ -package test.javafx.incubator.scene.mypkg; +package test.jfx.incubator.scene.mypkg; import com.sun.javafx.incubator.scene.mypkg.MyImpl; -import javafx.incubator.scene.mypkg.MyButton; -import javafx.incubator.scene.mypkg.MyButtonShim; +import jfx.incubator.scene.mypkg.MyButton; +import jfx.incubator.scene.mypkg.MyButtonShim; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; From 93ef93e44964f8d31c2b221abefc552916a44a8c Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Fri, 23 Feb 2024 08:47:13 -0800 Subject: [PATCH 12/30] Bump copyright date --- .../java/com/sun/javafx/incubator/scene/mypkg/MyImpl.java | 2 +- .../src/main/java/jfx/incubator/scene/mypkg/MyButton.java | 2 +- .../src/main/java/jfx/incubator/scene/mypkg/package-info.java | 2 +- .../jfx.incubator.myfeature/src/main/java/module-info.java | 2 +- .../shims/java/jfx/incubator/scene/mypkg/MyButtonShim.java | 2 +- modules/jfx.incubator.myfeature/src/test/addExports | 4 ++++ .../java/test/jfx/incubator/scene/mypkg/MyButtonTest.java | 2 +- 7 files changed, 10 insertions(+), 6 deletions(-) diff --git a/modules/jfx.incubator.myfeature/src/main/java/com/sun/javafx/incubator/scene/mypkg/MyImpl.java b/modules/jfx.incubator.myfeature/src/main/java/com/sun/javafx/incubator/scene/mypkg/MyImpl.java index aa3ddca1e84..137af3429ee 100644 --- a/modules/jfx.incubator.myfeature/src/main/java/com/sun/javafx/incubator/scene/mypkg/MyImpl.java +++ b/modules/jfx.incubator.myfeature/src/main/java/com/sun/javafx/incubator/scene/mypkg/MyImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 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 diff --git a/modules/jfx.incubator.myfeature/src/main/java/jfx/incubator/scene/mypkg/MyButton.java b/modules/jfx.incubator.myfeature/src/main/java/jfx/incubator/scene/mypkg/MyButton.java index 8b226121a1f..0f4a8d3fb45 100644 --- a/modules/jfx.incubator.myfeature/src/main/java/jfx/incubator/scene/mypkg/MyButton.java +++ b/modules/jfx.incubator.myfeature/src/main/java/jfx/incubator/scene/mypkg/MyButton.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 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 diff --git a/modules/jfx.incubator.myfeature/src/main/java/jfx/incubator/scene/mypkg/package-info.java b/modules/jfx.incubator.myfeature/src/main/java/jfx/incubator/scene/mypkg/package-info.java index 4c5983d936d..1bd385375d5 100644 --- a/modules/jfx.incubator.myfeature/src/main/java/jfx/incubator/scene/mypkg/package-info.java +++ b/modules/jfx.incubator.myfeature/src/main/java/jfx/incubator/scene/mypkg/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 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 diff --git a/modules/jfx.incubator.myfeature/src/main/java/module-info.java b/modules/jfx.incubator.myfeature/src/main/java/module-info.java index 339789a1a4e..e18ad0ce3d4 100644 --- a/modules/jfx.incubator.myfeature/src/main/java/module-info.java +++ b/modules/jfx.incubator.myfeature/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 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 diff --git a/modules/jfx.incubator.myfeature/src/shims/java/jfx/incubator/scene/mypkg/MyButtonShim.java b/modules/jfx.incubator.myfeature/src/shims/java/jfx/incubator/scene/mypkg/MyButtonShim.java index 653e01c55d9..0980ca5cbfe 100644 --- a/modules/jfx.incubator.myfeature/src/shims/java/jfx/incubator/scene/mypkg/MyButtonShim.java +++ b/modules/jfx.incubator.myfeature/src/shims/java/jfx/incubator/scene/mypkg/MyButtonShim.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 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 diff --git a/modules/jfx.incubator.myfeature/src/test/addExports b/modules/jfx.incubator.myfeature/src/test/addExports index 04454094b3e..a09469ea900 100644 --- a/modules/jfx.incubator.myfeature/src/test/addExports +++ b/modules/jfx.incubator.myfeature/src/test/addExports @@ -1,3 +1,7 @@ +# +# This file contains needed exports for running tests. Add or remove +# exports as needed. +# --add-exports javafx.base/com.sun.javafx=ALL-UNNAMED # --add-exports javafx.graphics/com.sun.javafx.application=ALL-UNNAMED diff --git a/modules/jfx.incubator.myfeature/src/test/java/test/jfx/incubator/scene/mypkg/MyButtonTest.java b/modules/jfx.incubator.myfeature/src/test/java/test/jfx/incubator/scene/mypkg/MyButtonTest.java index 055b1b253e8..64e9ada4c12 100644 --- a/modules/jfx.incubator.myfeature/src/test/java/test/jfx/incubator/scene/mypkg/MyButtonTest.java +++ b/modules/jfx.incubator.myfeature/src/test/java/test/jfx/incubator/scene/mypkg/MyButtonTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 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 From a4bf721b4c776fbe08b133a3f73bfa22a40b97be Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Fri, 23 Feb 2024 08:59:38 -0800 Subject: [PATCH 13/30] Additional comments --- build.gradle | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index f95e4db0582..59a4efbefb4 100644 --- a/build.gradle +++ b/build.gradle @@ -2770,7 +2770,12 @@ project(":controls") { } // TODO: incubator template -// Replace "myfeature" with the name of your feature +// To create an incubator module: +// 1) apply the changes from this patch +// 2) Look for "TODO: incubator template" comments, and replace "myfeature" +// with the name of your feature +// 3) Refactor / rename the files under "modules/javafx.incubator.myfeature" +// to match the name of your feature. project(":incubator.myfeature") { project.ext.buildModule = true project.ext.includeSources = true @@ -2817,7 +2822,12 @@ project(":incubator.myfeature") { modulePath += File.pathSeparator + "${rootProject.projectDir}/modules/javafx.graphics/build/classes/java/main" modulePath += File.pathSeparator + "${rootProject.projectDir}/modules/javafx.base/build/classes/java/main" - // FIXME: KCR +// TODO: incubator template +// The following block is used if and only if you have .css resource files +// in your incubator module. If you do, uncomment the block and make the +// appropriate changes for the location of your resource files. Otherwise, +// delete the block. + // processResources { // doLast { // def cssFiles = fileTree(dir: "$moduleDir/com/sun/javafx/scene/control/skin") From 691d52b8d7f5add6ff2a50bf51176f36e939a049 Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Sat, 24 Feb 2024 08:30:32 -0800 Subject: [PATCH 14/30] WIP: Utility for printing incubator warning --- .../main/java/com/sun/javafx/ModuleUtil.java | 84 +++++++++++++++++++ .../jfx/incubator/scene/mypkg/MyButton.java | 4 + 2 files changed, 88 insertions(+) create mode 100644 modules/javafx.base/src/main/java/com/sun/javafx/ModuleUtil.java diff --git a/modules/javafx.base/src/main/java/com/sun/javafx/ModuleUtil.java b/modules/javafx.base/src/main/java/com/sun/javafx/ModuleUtil.java new file mode 100644 index 00000000000..b681de79176 --- /dev/null +++ b/modules/javafx.base/src/main/java/com/sun/javafx/ModuleUtil.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.sun.javafx; + +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.HashSet; +import java.util.Set; + +/** + * Module utilities. + */ +public class ModuleUtil { + + private static final Set warnedModules = new HashSet<>(); + private static final Set warnedPackages = new HashSet<>(); + + private static final Module MODULE_JAVA_BASE = Module.class.getModule(); + + @SuppressWarnings("removal") + public static void incubatorWarning() { + AccessController.doPrivileged((PrivilegedAction) () -> { + var stackWalker = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE); + var callerClass = stackWalker.walk(s -> + s.dropWhile(f -> { + var clazz = f.getDeclaringClass(); + return ModuleUtil.class.equals(clazz) || MODULE_JAVA_BASE.equals(clazz.getModule()); + }) + .map(StackWalker.StackFrame::getDeclaringClass) + .findFirst() + .orElseThrow(IllegalStateException::new)); + //System.err.println("callerClass = " + callerClass); + var callerModule = callerClass.getModule(); + + // If we are using incubating API from the unnamed module, issue + // a warning one time for each package. This is not a supported + // mode, but can happen if the module is placed on the classpath. + if (!callerModule.isNamed()) { + var callerPackage = callerClass.getPackage(); + if (!warnedPackages.contains(callerPackage)) { + System.err.println("WARNING: Using incubating API from an unnamed module: " + callerPackage); + warnedPackages.add(callerPackage); + } + return null; + } + + // TODO: Check whether this module is jlinked into the runtime and + // thus has already printed a warning. + // Issue warning one time for this module + if (!warnedModules.contains(callerModule)) { + System.err.println("WARNING: Using incubator modules: " + callerModule.getName()); + warnedModules.add(callerModule); + } + + return null; + }); + } + + // Prevent instantiation + private ModuleUtil() { + } +} diff --git a/modules/jfx.incubator.myfeature/src/main/java/jfx/incubator/scene/mypkg/MyButton.java b/modules/jfx.incubator.myfeature/src/main/java/jfx/incubator/scene/mypkg/MyButton.java index 0f4a8d3fb45..4e97a157691 100644 --- a/modules/jfx.incubator.myfeature/src/main/java/jfx/incubator/scene/mypkg/MyButton.java +++ b/modules/jfx.incubator.myfeature/src/main/java/jfx/incubator/scene/mypkg/MyButton.java @@ -25,6 +25,7 @@ package jfx.incubator.scene.mypkg; +import com.sun.javafx.ModuleUtil; import com.sun.javafx.incubator.scene.mypkg.MyImpl; import javafx.scene.control.Button; @@ -35,6 +36,9 @@ * Will be removed in a future release. */ public class MyButton extends Button { + + static { ModuleUtil.incubatorWarning(); } + private final int myField; public MyButton(int myField, String name) { From d3bf81ec461d88a6712078ffad84e0411f8b4aa0 Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Fri, 1 Mar 2024 10:03:37 -0800 Subject: [PATCH 15/30] fixup comments in helper class --- .../src/main/java/com/sun/javafx/ModuleUtil.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/javafx.base/src/main/java/com/sun/javafx/ModuleUtil.java b/modules/javafx.base/src/main/java/com/sun/javafx/ModuleUtil.java index b681de79176..30757fea2e1 100644 --- a/modules/javafx.base/src/main/java/com/sun/javafx/ModuleUtil.java +++ b/modules/javafx.base/src/main/java/com/sun/javafx/ModuleUtil.java @@ -22,6 +22,8 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + +// TODO: incubator template package com.sun.javafx; import java.security.AccessController; @@ -56,7 +58,7 @@ public static void incubatorWarning() { // If we are using incubating API from the unnamed module, issue // a warning one time for each package. This is not a supported - // mode, but can happen if the module is placed on the classpath. + // mode, but can happen if the modular jar is put on the classpath. if (!callerModule.isNamed()) { var callerPackage = callerClass.getPackage(); if (!warnedPackages.contains(callerPackage)) { @@ -66,10 +68,11 @@ public static void incubatorWarning() { return null; } - // TODO: Check whether this module is jlinked into the runtime and - // thus has already printed a warning. // Issue warning one time for this module if (!warnedModules.contains(callerModule)) { + // FIXME: Check whether this module is jlinked into the runtime + // and thus has already printed a warning. Skip the warning in that + // case to avoid duplicate warnings. System.err.println("WARNING: Using incubator modules: " + callerModule.getName()); warnedModules.add(callerModule); } From 6b8b5718b0a5a75f9e1263a09d4ce4fe80ed55fc Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Fri, 1 Mar 2024 11:15:34 -0800 Subject: [PATCH 16/30] fix typo --- .../javafx.base/src/main/java/com/sun/javafx/ModuleUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/javafx.base/src/main/java/com/sun/javafx/ModuleUtil.java b/modules/javafx.base/src/main/java/com/sun/javafx/ModuleUtil.java index 30757fea2e1..1e3ce76367a 100644 --- a/modules/javafx.base/src/main/java/com/sun/javafx/ModuleUtil.java +++ b/modules/javafx.base/src/main/java/com/sun/javafx/ModuleUtil.java @@ -23,7 +23,7 @@ * questions. */ -// TODO: incubator template +// TODO: incubator dependency package com.sun.javafx; import java.security.AccessController; From 1de2efed437321a3d78919c3de5a2abf28cf54a5 Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Fri, 1 Mar 2024 11:16:04 -0800 Subject: [PATCH 17/30] add missing javadoc --- .../main/java/jfx/incubator/scene/mypkg/MyButton.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/jfx.incubator.myfeature/src/main/java/jfx/incubator/scene/mypkg/MyButton.java b/modules/jfx.incubator.myfeature/src/main/java/jfx/incubator/scene/mypkg/MyButton.java index 4e97a157691..d5187c3b3d8 100644 --- a/modules/jfx.incubator.myfeature/src/main/java/jfx/incubator/scene/mypkg/MyButton.java +++ b/modules/jfx.incubator.myfeature/src/main/java/jfx/incubator/scene/mypkg/MyButton.java @@ -41,8 +41,13 @@ public class MyButton extends Button { private final int myField; - public MyButton(int myField, String name) { - super(name); + /** + * Constructs my button. + * @param myField my field + * @param text the text string for the button + */ + public MyButton(int myField, String text) { + super(text); this.myField = myField; } From 97575a11b37a0f2afcf8620221e5d07df6a6f4cb Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Fri, 1 Mar 2024 12:58:19 -0800 Subject: [PATCH 18/30] Update instructions to create a new incubator module --- INCUBATOR-MODULES.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/INCUBATOR-MODULES.md b/INCUBATOR-MODULES.md index 3a17e327d97..fb0826867ce 100644 --- a/INCUBATOR-MODULES.md +++ b/INCUBATOR-MODULES.md @@ -29,8 +29,11 @@ JavaFX incubator modules have a few differences from JDK incubator modules: - An incubating API that spans beyond a 24-month period (4 feature releases), and is not yet ready to be finalized, will need explicit approval from a Project Lead to remain incubating for some additional period at the discretion of a Project Lead. Otherwise, a Project Lead will submit a removal JEP. - The submitter of the original JEP can propose to remove it at any time. -## How to add a new incubator modules +## How to add a new incubator module -In addition to creating the new modules under `modules/jfx.incubator.myfeature`, you need to update `build.gradle` and `settings.gradle` to add the new module. +Use [this patch](https://github.com/openjdk/jfx/pull/1375.diff) as a starting point for your incubator module. Then do the following: +- Rename `modules/jfx.incubator.myfeature` to the desired name of your module, keeping the `jfx.incubator. prefix` +- Modify `build.gradle`, `settings.gradle`, and `modules/javafx.base/src/main/java/module-info.java` to update the name of your module. Look for comments of the form `// TODO: incubator template` for where to make the changes. +- Develop your module as you would with any JavaFX module, keeping in mind the rules in this JEP about public exports and dependencies. -FIXME: finish this +FIXME: find a permanent home for the incubator module template patch, possibly in the jfx-sandbox repo. From 75d0c0749d552f604e12d8a5882e845233501ecd Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Wed, 1 May 2024 13:14:49 -0700 Subject: [PATCH 19/30] Add missing dependency on incubator module to systemTests so ModuleLauncherTest will work --- build.gradle | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 6efeccdb650..ab0bf6f800b 100644 --- a/build.gradle +++ b/build.gradle @@ -3976,7 +3976,18 @@ project(":systemTests") { testImplementation project(":swing").sourceSets.test.output } - def dependentProjects = [ 'base', 'graphics', 'controls', 'media', 'web', 'swing', 'fxml' ] + // TODO: incubator dependency + def dependentProjects = [ + 'base', + 'graphics', + 'controls', + // TODO: incubator template + 'incubator.myfeature', + 'media', + 'web', + 'swing', + 'fxml' + ] commonModuleSetup(project, dependentProjects) File testJavaPolicyFile = new File(rootProject.buildDir, TESTJAVAPOLICYFILE); From 1fd34b068d229d2de61a6ba92801b39a342954b5 Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Fri, 10 May 2024 13:39:50 -0700 Subject: [PATCH 20/30] Minor formatting update --- INCUBATOR-MODULES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INCUBATOR-MODULES.md b/INCUBATOR-MODULES.md index fb0826867ce..66c2e3167dd 100644 --- a/INCUBATOR-MODULES.md +++ b/INCUBATOR-MODULES.md @@ -32,7 +32,7 @@ JavaFX incubator modules have a few differences from JDK incubator modules: ## How to add a new incubator module Use [this patch](https://github.com/openjdk/jfx/pull/1375.diff) as a starting point for your incubator module. Then do the following: -- Rename `modules/jfx.incubator.myfeature` to the desired name of your module, keeping the `jfx.incubator. prefix` +- Rename `modules/jfx.incubator.myfeature` to the desired name of your module, keeping the `jfx.incubator.` prefix. - Modify `build.gradle`, `settings.gradle`, and `modules/javafx.base/src/main/java/module-info.java` to update the name of your module. Look for comments of the form `// TODO: incubator template` for where to make the changes. - Develop your module as you would with any JavaFX module, keeping in mind the rules in this JEP about public exports and dependencies. From 562617530a93c7fd901015b669e0fbfdc8c123b4 Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Fri, 10 May 2024 14:33:59 -0700 Subject: [PATCH 21/30] Cleanup prior to preparing RFE for incubator dependencies --- build.gradle | 62 ++++++++++++++----- .../main/java/com/sun/javafx/ModuleUtil.java | 12 +++- .../src/main/java/module-info.java | 10 ++- settings.gradle | 22 ++++++- 4 files changed, 85 insertions(+), 21 deletions(-) diff --git a/build.gradle b/build.gradle index eafe9b69d96..b10b56793b1 100644 --- a/build.gradle +++ b/build.gradle @@ -942,7 +942,7 @@ List computeLibraryPath(boolean working) { def modulesLibsDir = "${bundledSdkDir}/modules_libs" modsWithNative.each() { m -> - // TODO: incubator dependency + // RFE: incubator dependency if (m.hasProperty("moduleName")) { def moduleName = m.ext.moduleName lp << cygpath("${modulesLibsDir}/${moduleName}") @@ -1680,7 +1680,7 @@ void addMavenPublication(Project project, List projectDependencies) { return } - // TODO: incubator dependency + // RFE: incubator dependency if (!m.hasProperty("moduleName")) { fail("Project ${m} has no module name") } @@ -1740,7 +1740,7 @@ void addMavenPublication(Project project, List projectDependencies) { project.publishing { publications { maven(MavenPublication) { - // TODO: incubator dependency + // RFE: incubator dependency def artifactName = project.moduleName.replace('.', '-') artifactId = artifactName @@ -1761,18 +1761,18 @@ void addMavenPublication(Project project, List projectDependencies) { Node projectDependencyPlatform = dependencies.appendNode("dependency") projectDependencyPlatform.appendNode("groupId", MAVEN_GROUP_ID) - // TODO: incubator dependency + // RFE: incubator dependency projectDependencyPlatform.appendNode("artifactId", artifactName) projectDependencyPlatform.appendNode("version", MAVEN_VERSION) projectDependencyPlatform.appendNode("classifier", "\${javafx.platform}") if (!projectDependencies.empty) { projectDependencies.each { dep -> - // TODO: incubator dependency + // RFE: incubator dependency def depName = dep.moduleName.replace('.', '-') Node projectDependency = dependencies.appendNode("dependency") projectDependency.appendNode("groupId", MAVEN_GROUP_ID) - // TODO: incubator dependency + // RFE: incubator dependency projectDependency.appendNode("artifactId", depName) projectDependency.appendNode("version", MAVEN_VERSION) } @@ -2772,13 +2772,27 @@ project(":controls") { addValidateSourceSets(project, sourceSets) } -// TODO: incubator template +// RFE: incubator dependency +// TODO: incubator: Add a project declaration for each incubator module here +// BEGIN: incubator placeholder +//project(":incubator.mymod") { +// project.ext.buildModule = true +// project.ext.includeSources = true +// project.ext.moduleRuntime = true +// project.ext.moduleName = "jfx.incubator.mymod" +// project.ext.incubating = true +// ... +//} +// END: incubator placeholder + +// TODO: incubator template -- follow instruction below, then remove this comment // To create an incubator module: // 1) apply the changes from this patch // 2) Look for "TODO: incubator template" comments, and replace "myfeature" // with the name of your feature // 3) Refactor / rename the files under "modules/javafx.incubator.myfeature" // to match the name of your feature. +// 4) Remove this comment block project(":incubator.myfeature") { project.ext.buildModule = true project.ext.includeSources = true @@ -2825,7 +2839,7 @@ project(":incubator.myfeature") { modulePath += File.pathSeparator + "${rootProject.projectDir}/modules/javafx.graphics/build/classes/java/main" modulePath += File.pathSeparator + "${rootProject.projectDir}/modules/javafx.base/build/classes/java/main" -// TODO: incubator template +// TODO: incubator template -- follow instruction below, then remove this comment block // The following block is used if and only if you have .css resource files // in your incubator module. If you do, uncomment the block and make the // appropriate changes for the location of your resource files. Otherwise, @@ -3976,13 +3990,21 @@ project(":systemTests") { testImplementation project(":swing").sourceSets.test.output } - // TODO: incubator dependency + // RFE: incubator dependency def dependentProjects = [ 'base', 'graphics', 'controls', - // TODO: incubator template + + // RFE: incubator dependency + // TODO: incubator: Add entry for each incubator module here + // BEGIN: incubator placeholder + //'incubator.mymod', + // END: incubator placeholder + + // TODO: incubator template -- rename module, then remove this TODO comment 'incubator.myfeature', + 'media', 'web', 'swing', @@ -4366,13 +4388,21 @@ task javadoc(type: Javadoc, dependsOn: createMSPfile) { group = "Basic" description = "Generates the JavaDoc for all the public API" executable = JAVADOC - // TODO: incubator dependency + // RFE: incubator dependency def projectsToDocument = [ project(":base"), project(":graphics"), project(":controls"), - // TODO: incubator template + + // RFE: incubator dependency + // TODO: incubator: Add entry for each incubator module here + // BEGIN: incubator placeholder + //project(":incubator.mymod"), + // END: incubator placeholder + + // TODO: incubator template -- rename module, then remove this TODO comment project(":incubator.myfeature"), + project(":media"), project(":swing"), /*project(":swt"),*/ @@ -5701,7 +5731,7 @@ compileTargets { t -> def modnames = [] moduleProjList.each { project -> if (project.hasProperty("moduleName") && project.buildModule) { - // TODO: incubator dependency + // RFE: incubator dependency def incubating = project.hasProperty("incubating") && project.ext.incubating modnames << project.ext.moduleName File dir; @@ -5714,7 +5744,7 @@ compileTargets { t -> def dstModuleDir = cygpath(dir.path) modpath << "${dstModuleDir}" - // TODO: incubator dependency + // RFE: incubator dependency if (!incubating) { String themod = dir.toURI() testJavaPolicyFile << "grant codeBase \"${themod}\" {\n" + @@ -5772,7 +5802,7 @@ compileTargets { t -> def jmodName = "${moduleName}.jmod" def jmodFile = "${jmodsDir}/${jmodName}" - // TODO: incubator dependency + // RFE: incubator dependency def incubating = project.hasProperty("incubating") && project.ext.incubating // On Windows, copy the native libraries in the jmod image @@ -5816,7 +5846,7 @@ compileTargets { t -> if (sourceDateEpoch != null) { args("--date", extendedTimestamp) } - // TODO: incubator dependency + // RFE: incubator dependency if (incubating) { args("--do-not-resolve-by-default") args("--warn-if-resolved=incubating") diff --git a/modules/javafx.base/src/main/java/com/sun/javafx/ModuleUtil.java b/modules/javafx.base/src/main/java/com/sun/javafx/ModuleUtil.java index 1e3ce76367a..71e98bd3393 100644 --- a/modules/javafx.base/src/main/java/com/sun/javafx/ModuleUtil.java +++ b/modules/javafx.base/src/main/java/com/sun/javafx/ModuleUtil.java @@ -23,7 +23,7 @@ * questions. */ -// TODO: incubator dependency +// RFE: incubator dependency package com.sun.javafx; import java.security.AccessController; @@ -41,6 +41,16 @@ public class ModuleUtil { private static final Module MODULE_JAVA_BASE = Module.class.getModule(); + /** + * Prints a warning that an incubator module was loaded. This warning is + * printed to {@code System.err} one time per module. + * An incubator module should call this method from the static initializer + * of each primary class in the module. A primary class is a publicly exported + * class that provides functionality that can be used by an application. + * An incubator module should choose the set of primary classes such that + * any application using an incubating API would access at least one of the + * primary classes. + */ @SuppressWarnings("removal") public static void incubatorWarning() { AccessController.doPrivileged((PrivilegedAction) () -> { diff --git a/modules/javafx.base/src/main/java/module-info.java b/modules/javafx.base/src/main/java/module-info.java index 0f0b07f4fdc..6293170e60f 100644 --- a/modules/javafx.base/src/main/java/module-info.java +++ b/modules/javafx.base/src/main/java/module-info.java @@ -47,8 +47,16 @@ exports com.sun.javafx to javafx.controls, - // TODO: incubator template + + // RFE: incubator dependency + // TODO: incubator: Add entry for each incubator module here + // BEGIN: incubator placeholder + //jfx.incubator.mymod, + // END: incubator placeholder + + // TODO: incubator template -- rename module, then remove this TODO comment jfx.incubator.myfeature, + javafx.graphics, javafx.fxml, javafx.media, diff --git a/settings.gradle b/settings.gradle index 11bb301d512..b52d024f92b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -23,12 +23,20 @@ * questions. */ -// TODO: incubator dependency +// RFE: incubator dependency include "base", "graphics", "controls", - // TODO: incubator template + + // RFE: incubator dependency + // TODO: incubator: Add entry for each incubator module here + // BEGIN: incubator placeholder + //"incubator.mymod", + // END: incubator placeholder + + // TODO: incubator template -- rename module, then remove this TODO comment "incubator.myfeature", + "swing", "swt", "fxml", @@ -39,8 +47,16 @@ include "base", project(":base").projectDir = file("modules/javafx.base") project(":graphics").projectDir = file("modules/javafx.graphics") project(":controls").projectDir = file("modules/javafx.controls") -// TODO: incubator template + +// RFE: incubator dependency +// TODO: incubator: Add entry for each incubator module here +// BEGIN: incubator placeholder +//project(":incubator.mymod").projectDir = file("modules/jfx.incubator.mymod") +// END: incubator placeholder + +// TODO: incubator template -- rename module, then remove this TODO comment project(":incubator.myfeature").projectDir = file("modules/jfx.incubator.myfeature") + project(":swing").projectDir = file("modules/javafx.swing") project(":swt").projectDir = file("modules/javafx.swt") project(":fxml").projectDir = file("modules/javafx.fxml") From bb46c46d4d308fd13455341492076b6cba42f187 Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Mon, 13 May 2024 11:01:16 -0700 Subject: [PATCH 22/30] Add some implementation notes --- NOTES-INCUBATOR.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 NOTES-INCUBATOR.md diff --git a/NOTES-INCUBATOR.md b/NOTES-INCUBATOR.md new file mode 100644 index 00000000000..d64b7f85c40 --- /dev/null +++ b/NOTES-INCUBATOR.md @@ -0,0 +1,37 @@ +# NOTES: JavaFX Incubator Modules + +## Overview + +These are notes regarding the implementation of JavaFX incubator modules. + +## Changes / additions in the javafx.incubator branch + +The `javafx.incubator` branch has three main types of changes: + +1. The [JavaFX Incubator Modules JEP](INCUBATOR-MODULES.md) and these implementation notes. +2. Changes needed to support incubator modules. These include: build scripts (`build.gradle`, `settings.gradle`), qualified exports from `javafx.base`, and a utility class to produce warnings when first using an incubator module. +3. A sample incubator module, `jfx.incubator.myfeature`. + +Note that this branch is meant to be illustrative in nature. It will _never_ be integrated, so the PR based on this branch will remain in Draft state as long as the PR is open (it will _never_ become `rfr`). + +## RFE: Support incubator modules + +The changes reflected in item 2 in the previous section need to be integrated into mainline ahead of the first incubator module, so a separate PR will be made from a branch that has just those changes. In support of this, the needed changes have been highlighted using comments of the following pattern: + +``` +// RFE: incubator dependency +``` + +These identify the blocks that are needed as part of the RFE to add the needed dependencies. The PR that includes them will remove the `RFE: incubator dependency` line, since that is only there to differentiate those changes needed to support incubator modules in general from those changes that add the specific sample incubator module (`jfx.incubator.myfeature`). The sample incubator module changes must be reverted in the branch that will be used to add the dependencies. + +Some of the incubator dependency changes include comments about where to add build logic when creating an incubator module. Those comment will be part of the incubator dependency PR. For example: + +``` + // RFE: incubator dependency + // TODO: incubator: Add entry for each incubator module here + // BEGIN: incubator placeholder + //'incubator.mymod', + // END: incubator placeholder +``` + +When proposing the incubator dependency PR, the `// RFE: incubator dependency` line will be removed (since it only exists to help identify the needed dependency), but the rest of the comment block (starting with `TODO: incubator: ...`) will be part of the PR. From fa50d1e276c684c66d6d566ed8e48ff99338603e Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Thu, 25 Jul 2024 10:01:43 -0700 Subject: [PATCH 23/30] Fixup javafx.* assumptions --- build.gradle | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/build.gradle b/build.gradle index b7c511d7dae..d0b460f02e5 100644 --- a/build.gradle +++ b/build.gradle @@ -967,7 +967,8 @@ List computeLibraryPath(boolean working) { List lp = [] if (HAS_JAVAFX_MODULES) { - List modsWithNative = [ 'graphics', 'media', 'web' ] + // BUG: javafx.[a-z]* assumption + List modsWithNative = [ 'javafx.graphics', 'javafx.media', 'javafx.web' ] // the build/modular-sdk area def platformPrefix = "" @@ -976,11 +977,8 @@ List computeLibraryPath(boolean working) { def modulesLibsDir = "${bundledSdkDir}/modules_libs" modsWithNative.each() { m -> - // RFE: incubator dependency - if (m.hasProperty("moduleName")) { - def moduleName = m.ext.moduleName - lp << cygpath("${modulesLibsDir}/${moduleName}") - } + // BUG: javafx.[a-z]* assumption + lp << cygpath("${modulesLibsDir}/${m}") } } else { def platformPrefix = "" @@ -1714,14 +1712,17 @@ void addMavenPublication(Project project, List projectDependencies) { return } - // RFE: incubator dependency - if (!m.hasProperty("moduleName")) { - fail("Project ${m} has no module name") + // BUG: javafx.[a-z]* assumption + if (!project.hasProperty("moduleName")) { + fail("Project ${project} has no module name") } - projectDependencies.each { dep -> + println "KCR: project = $project" + projectDependencies.each { projName -> + def dep = project.project(":$projName") if (!dep.hasProperty("moduleName")) { - fail("Project ${m} dependency ${dep} has no module name") + fail("${project} dependency ${dep} has no module name") } + println "KCR: dependency = $dep" } project.apply plugin: 'maven-publish' @@ -1774,9 +1775,10 @@ void addMavenPublication(Project project, List projectDependencies) { project.publishing { publications { maven(MavenPublication) { - // RFE: incubator dependency + // BUG: javafx.[a-z]* assumption def artifactName = project.moduleName.replace('.', '-') artifactId = artifactName + println "KCR: artifactId = $artifactName" afterEvaluate { artifact project.tasks."moduleEmptyPublicationJar$t.capital" @@ -1795,19 +1797,21 @@ void addMavenPublication(Project project, List projectDependencies) { Node projectDependencyPlatform = dependencies.appendNode("dependency") projectDependencyPlatform.appendNode("groupId", MAVEN_GROUP_ID) - // RFE: incubator dependency + // BUG: javafx.[a-z]* assumption projectDependencyPlatform.appendNode("artifactId", artifactName) + println "KCR: artifactId = ${artifactName}" projectDependencyPlatform.appendNode("version", MAVEN_VERSION) projectDependencyPlatform.appendNode("classifier", "\${javafx.platform}") if (!projectDependencies.empty) { projectDependencies.each { dep -> - // RFE: incubator dependency + // BUG: javafx.[a-z]* assumption def depName = dep.moduleName.replace('.', '-') Node projectDependency = dependencies.appendNode("dependency") projectDependency.appendNode("groupId", MAVEN_GROUP_ID) - // RFE: incubator dependency + // BUG: javafx.[a-z]* assumption projectDependency.appendNode("artifactId", depName) + println "KCR: artifactId = $depName" projectDependency.appendNode("version", MAVEN_VERSION) } } From b6631ca1179d488736dbb5af17313b5b44d0851c Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Fri, 26 Jul 2024 08:55:22 -0700 Subject: [PATCH 24/30] 8337281: build.gradle assumes all modules are named "javafx.$project" --- build.gradle | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 0885f064033..7f975ca9fef 100644 --- a/build.gradle +++ b/build.gradle @@ -967,7 +967,7 @@ List computeLibraryPath(boolean working) { List lp = [] if (HAS_JAVAFX_MODULES) { - List modsWithNative = [ 'graphics', 'media', 'web' ] + List modsWithNative = [ 'javafx.graphics', 'javafx.media', 'javafx.web' ] // the build/modular-sdk area def platformPrefix = "" @@ -976,7 +976,7 @@ List computeLibraryPath(boolean working) { def modulesLibsDir = "${bundledSdkDir}/modules_libs" modsWithNative.each() { m -> - lp << cygpath("${modulesLibsDir}/javafx.${m}") + lp << cygpath("${modulesLibsDir}/${m}") } } else { def platformPrefix = "" @@ -1710,6 +1710,18 @@ void addMavenPublication(Project project, List projectDependencies) { return } + if (!project.hasProperty("moduleName")) { + fail("Project ${project} has no module name") + } + println "KCR: project = $project" + projectDependencies.each { projName -> + def dep = project.project(":$projName") + if (!dep.hasProperty("moduleName")) { + fail("${project} dependency ${dep} has no module name") + } + println "KCR: dependency = $dep" + } + project.apply plugin: 'maven-publish' project.group = MAVEN_GROUP_ID @@ -1760,7 +1772,9 @@ void addMavenPublication(Project project, List projectDependencies) { project.publishing { publications { maven(MavenPublication) { - artifactId = "javafx-${project.name}" + def artifactName = project.moduleName.replace('.', '-') + artifactId = artifactName + println "KCR: artifactId = $artifactName" afterEvaluate { artifact project.tasks."moduleEmptyPublicationJar$t.capital" @@ -1779,15 +1793,18 @@ void addMavenPublication(Project project, List projectDependencies) { Node projectDependencyPlatform = dependencies.appendNode("dependency") projectDependencyPlatform.appendNode("groupId", MAVEN_GROUP_ID) - projectDependencyPlatform.appendNode("artifactId", "javafx-${project.name}") + projectDependencyPlatform.appendNode("artifactId", artifactName) + println "KCR: artifactId = ${artifactName}" projectDependencyPlatform.appendNode("version", MAVEN_VERSION) projectDependencyPlatform.appendNode("classifier", "\${javafx.platform}") if (!projectDependencies.empty) { projectDependencies.each { dep -> + def depName = dep.moduleName.replace('.', '-') Node projectDependency = dependencies.appendNode("dependency") projectDependency.appendNode("groupId", MAVEN_GROUP_ID) - projectDependency.appendNode("artifactId", "javafx-$dep") + projectDependency.appendNode("artifactId", depName) + println "KCR: artifactId = $depName" projectDependency.appendNode("version", MAVEN_VERSION) } } From 7d25dd82f90aea0df3a7cc967ca53fed013826c4 Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Fri, 26 Jul 2024 10:07:46 -0700 Subject: [PATCH 25/30] Remove debug prints --- build.gradle | 5 ----- 1 file changed, 5 deletions(-) diff --git a/build.gradle b/build.gradle index 7f975ca9fef..8d44016db60 100644 --- a/build.gradle +++ b/build.gradle @@ -1713,13 +1713,11 @@ void addMavenPublication(Project project, List projectDependencies) { if (!project.hasProperty("moduleName")) { fail("Project ${project} has no module name") } - println "KCR: project = $project" projectDependencies.each { projName -> def dep = project.project(":$projName") if (!dep.hasProperty("moduleName")) { fail("${project} dependency ${dep} has no module name") } - println "KCR: dependency = $dep" } project.apply plugin: 'maven-publish' @@ -1774,7 +1772,6 @@ void addMavenPublication(Project project, List projectDependencies) { maven(MavenPublication) { def artifactName = project.moduleName.replace('.', '-') artifactId = artifactName - println "KCR: artifactId = $artifactName" afterEvaluate { artifact project.tasks."moduleEmptyPublicationJar$t.capital" @@ -1794,7 +1791,6 @@ void addMavenPublication(Project project, List projectDependencies) { Node projectDependencyPlatform = dependencies.appendNode("dependency") projectDependencyPlatform.appendNode("groupId", MAVEN_GROUP_ID) projectDependencyPlatform.appendNode("artifactId", artifactName) - println "KCR: artifactId = ${artifactName}" projectDependencyPlatform.appendNode("version", MAVEN_VERSION) projectDependencyPlatform.appendNode("classifier", "\${javafx.platform}") @@ -1804,7 +1800,6 @@ void addMavenPublication(Project project, List projectDependencies) { Node projectDependency = dependencies.appendNode("dependency") projectDependency.appendNode("groupId", MAVEN_GROUP_ID) projectDependency.appendNode("artifactId", depName) - println "KCR: artifactId = $depName" projectDependency.appendNode("version", MAVEN_VERSION) } } From 32e3e75cd7c0862a3a5064d1c95742e5b5c57347 Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Fri, 26 Jul 2024 10:23:56 -0700 Subject: [PATCH 26/30] Remove BUG comments and debug prints --- build.gradle | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/build.gradle b/build.gradle index d0b460f02e5..289b45e20f1 100644 --- a/build.gradle +++ b/build.gradle @@ -967,7 +967,6 @@ List computeLibraryPath(boolean working) { List lp = [] if (HAS_JAVAFX_MODULES) { - // BUG: javafx.[a-z]* assumption List modsWithNative = [ 'javafx.graphics', 'javafx.media', 'javafx.web' ] // the build/modular-sdk area @@ -977,7 +976,6 @@ List computeLibraryPath(boolean working) { def modulesLibsDir = "${bundledSdkDir}/modules_libs" modsWithNative.each() { m -> - // BUG: javafx.[a-z]* assumption lp << cygpath("${modulesLibsDir}/${m}") } } else { @@ -1712,17 +1710,14 @@ void addMavenPublication(Project project, List projectDependencies) { return } - // BUG: javafx.[a-z]* assumption if (!project.hasProperty("moduleName")) { fail("Project ${project} has no module name") } - println "KCR: project = $project" projectDependencies.each { projName -> def dep = project.project(":$projName") if (!dep.hasProperty("moduleName")) { fail("${project} dependency ${dep} has no module name") } - println "KCR: dependency = $dep" } project.apply plugin: 'maven-publish' @@ -1775,10 +1770,8 @@ void addMavenPublication(Project project, List projectDependencies) { project.publishing { publications { maven(MavenPublication) { - // BUG: javafx.[a-z]* assumption def artifactName = project.moduleName.replace('.', '-') artifactId = artifactName - println "KCR: artifactId = $artifactName" afterEvaluate { artifact project.tasks."moduleEmptyPublicationJar$t.capital" @@ -1797,21 +1790,16 @@ void addMavenPublication(Project project, List projectDependencies) { Node projectDependencyPlatform = dependencies.appendNode("dependency") projectDependencyPlatform.appendNode("groupId", MAVEN_GROUP_ID) - // BUG: javafx.[a-z]* assumption projectDependencyPlatform.appendNode("artifactId", artifactName) - println "KCR: artifactId = ${artifactName}" projectDependencyPlatform.appendNode("version", MAVEN_VERSION) projectDependencyPlatform.appendNode("classifier", "\${javafx.platform}") if (!projectDependencies.empty) { projectDependencies.each { dep -> - // BUG: javafx.[a-z]* assumption def depName = dep.moduleName.replace('.', '-') Node projectDependency = dependencies.appendNode("dependency") projectDependency.appendNode("groupId", MAVEN_GROUP_ID) - // BUG: javafx.[a-z]* assumption projectDependency.appendNode("artifactId", depName) - println "KCR: artifactId = $depName" projectDependency.appendNode("version", MAVEN_VERSION) } } From 50d90122db70c6bae641d1e33a9e6f8bdeb44fb3 Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Fri, 26 Jul 2024 15:56:44 -0700 Subject: [PATCH 27/30] Fix bug where String was being used as if it were a Project --- build.gradle | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 8d44016db60..b1ab109d4e3 100644 --- a/build.gradle +++ b/build.gradle @@ -1795,7 +1795,8 @@ void addMavenPublication(Project project, List projectDependencies) { projectDependencyPlatform.appendNode("classifier", "\${javafx.platform}") if (!projectDependencies.empty) { - projectDependencies.each { dep -> + projectDependencies.each { projName -> + def dep = project.project(":$projName") def depName = dep.moduleName.replace('.', '-') Node projectDependency = dependencies.appendNode("dependency") projectDependency.appendNode("groupId", MAVEN_GROUP_ID) From 6659c48925b94f4c3445e1c37079c4831d1d483f Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Tue, 22 Oct 2024 16:15:40 -0700 Subject: [PATCH 28/30] Comment changes --- build.gradle | 9 ++++++--- modules/javafx.base/src/main/java/module-info.java | 3 ++- settings.gradle | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 6f869031d19..e29efa7c313 100644 --- a/build.gradle +++ b/build.gradle @@ -2875,7 +2875,8 @@ project(":controls") { } // RFE: incubator dependency -// TODO: incubator: Add a project declaration for each incubator module here +// Add a project declaration for each incubator module here, leaving the +// incubator placeholder lines as an example. // BEGIN: incubator placeholder //project(":incubator.mymod") { // project.ext.buildModule = true @@ -4144,7 +4145,8 @@ project(":systemTests") { 'controls', // RFE: incubator dependency - // TODO: incubator: Add entry for each incubator module here + // Add an entry for each incubator module here, leaving the incubator + // placeholder lines as an example. // BEGIN: incubator placeholder //'incubator.mymod', // END: incubator placeholder @@ -4609,7 +4611,8 @@ task javadoc(type: Javadoc, dependsOn: createMSPfile) { project(":controls"), // RFE: incubator dependency - // TODO: incubator: Add entry for each incubator module here + // Add an entry for each incubator module here, leaving the incubator + // placeholder lines as an example. // BEGIN: incubator placeholder //project(":incubator.mymod"), // END: incubator placeholder diff --git a/modules/javafx.base/src/main/java/module-info.java b/modules/javafx.base/src/main/java/module-info.java index 6293170e60f..a8ad75d1acb 100644 --- a/modules/javafx.base/src/main/java/module-info.java +++ b/modules/javafx.base/src/main/java/module-info.java @@ -49,7 +49,8 @@ javafx.controls, // RFE: incubator dependency - // TODO: incubator: Add entry for each incubator module here + // Add an entry for each incubator module here, leaving the incubator + // placeholder lines as an example. // BEGIN: incubator placeholder //jfx.incubator.mymod, // END: incubator placeholder diff --git a/settings.gradle b/settings.gradle index d86dbaaab8a..fb0b4b53fd5 100644 --- a/settings.gradle +++ b/settings.gradle @@ -29,7 +29,8 @@ include "base", "controls", // RFE: incubator dependency - // TODO: incubator: Add entry for each incubator module here + // Add an entry for each incubator module here, leaving the incubator + // placeholder lines as an example. // BEGIN: incubator placeholder //"incubator.mymod", // END: incubator placeholder @@ -50,7 +51,8 @@ project(":graphics").projectDir = file("modules/javafx.graphics") project(":controls").projectDir = file("modules/javafx.controls") // RFE: incubator dependency -// TODO: incubator: Add entry for each incubator module here +// Add an entry for each incubator module here, leaving the incubator +// placeholder lines as an example. // BEGIN: incubator placeholder //project(":incubator.mymod").projectDir = file("modules/jfx.incubator.mymod") // END: incubator placeholder From f24f7007894016611900daa4d326924197091cd5 Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Tue, 22 Oct 2024 16:19:00 -0700 Subject: [PATCH 29/30] Update NOTES-INCUBATOR.md --- NOTES-INCUBATOR.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/NOTES-INCUBATOR.md b/NOTES-INCUBATOR.md index d64b7f85c40..37befa537e5 100644 --- a/NOTES-INCUBATOR.md +++ b/NOTES-INCUBATOR.md @@ -28,10 +28,11 @@ Some of the incubator dependency changes include comments about where to add bui ``` // RFE: incubator dependency - // TODO: incubator: Add entry for each incubator module here + // Add an entry for each incubator module here, leaving the incubator + // placeholder lines as an example. // BEGIN: incubator placeholder //'incubator.mymod', // END: incubator placeholder ``` -When proposing the incubator dependency PR, the `// RFE: incubator dependency` line will be removed (since it only exists to help identify the needed dependency), but the rest of the comment block (starting with `TODO: incubator: ...`) will be part of the PR. +When proposing the incubator dependency PR, the `// RFE: incubator dependency` line will be removed (since it only exists to help identify the needed dependency), but the rest of the comment block (e.g., starting with `Add an entry for each incubator ...`) will be part of the PR. From 3a7d4bfc75320377a49717d1247d99ef5b8c7851 Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Wed, 23 Oct 2024 08:02:46 -0700 Subject: [PATCH 30/30] Update INCUBATOR-MODULES.md --- INCUBATOR-MODULES.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/INCUBATOR-MODULES.md b/INCUBATOR-MODULES.md index 66c2e3167dd..6fccac9de93 100644 --- a/INCUBATOR-MODULES.md +++ b/INCUBATOR-MODULES.md @@ -1,10 +1,16 @@ # JavaFX Incubator Modules -## Overview +## Summary -In [JEP 11](https://openjdk.org/jeps/11), the JDK provides incubator modules as a means of putting non-final API in the hands of developers, while the API progresses towards either finalization or removal in a future release. +JavaFX incubator modules are a means of putting non-final APIs in the hands of developers, while the APIs progress towards either finalization or removal in a future release. This JEP builds on [JEP 11](https://openjdk.org/jeps/11), which defines JDK incubator modules. -Similarly, some JavaFX APIs would benefit from spending a period of time in a JavaFX release prior to being deemed stable. Being in the mainline `jfx` repository, and thus in downstream binaries such as those at jdk.java.net, makes it easier for interested parties outside of the immediate OpenJDK Community to use the new feature. Experience gained and fed back through the usual channels such as blogs, mailing lists, outreach programs, and conferences can then be acted upon before finalizing, or else removing, the feature in a future release. +## Goals + +Extends the benefits of [JEP 11](https://openjdk.org/jeps/11) to the JavaFX API. + +## Motivation + +Some JavaFX APIs would benefit from spending a period of time in a JavaFX release prior to being deemed stable. Being in the mainline `jfx` repository, and thus in downstream binaries such as those at jdk.java.net, makes it easier for interested parties outside of the immediate OpenJDK Community to use the new feature. Experience gained and fed back through the usual channels such as blogs, mailing lists, outreach programs, and conferences can then be acted upon before finalizing, or else removing, the feature in a future release. This is especially useful for complex features with a large API surface. Such features are nearly impossible to get right the first time, even after an extensive review. Using an incubator module will allow the API to evolve in future releases without the strict compatibility constraints that core JavaFX modules have. @@ -29,7 +35,7 @@ JavaFX incubator modules have a few differences from JDK incubator modules: - An incubating API that spans beyond a 24-month period (4 feature releases), and is not yet ready to be finalized, will need explicit approval from a Project Lead to remain incubating for some additional period at the discretion of a Project Lead. Otherwise, a Project Lead will submit a removal JEP. - The submitter of the original JEP can propose to remove it at any time. -## How to add a new incubator module +### How to add a new incubator module Use [this patch](https://github.com/openjdk/jfx/pull/1375.diff) as a starting point for your incubator module. Then do the following: - Rename `modules/jfx.incubator.myfeature` to the desired name of your module, keeping the `jfx.incubator.` prefix.