Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDK-8250768: javac should be adapted to changes in JEP 12 #703

Closed
wants to merge 59 commits into from
Closed
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
0694db0
8250768: a prototype of updates for JEP 12.
Sep 3, 2020
b9dbff5
Updates to the preview javadoc appearance.
Sep 3, 2020
70286c0
Experimenting with UI for preview links.
Sep 8, 2020
637b8c3
Experimenting with UI for preview links.
Sep 9, 2020
7ffc68f
Merging master into JDK-8250768
Sep 10, 2020
df6db2e
More experiments on Preview stuff in javadoc.
Sep 10, 2020
d27c4dc
More updates to the javadoc Preview UI.
Sep 15, 2020
00e2b94
Merge branch 'master' into JDK-8250768
Sep 16, 2020
34f4355
Merge branch 'master' into JDK-8250768
Sep 21, 2020
82f1c3a
More updateds to the preview javadoc appearance.
Sep 23, 2020
976755d
Merging master into JDK-8250768
Oct 2, 2020
d88fdd4
More updates to javadoc appearance
Oct 5, 2020
26a2280
Merging master into JDK-8250768
Oct 7, 2020
1b9a052
A post-merge fix.
Oct 7, 2020
7cb5085
Cleaning up preview in javadoc.
Oct 13, 2020
79b89dd
Fixing tests.
Oct 14, 2020
1425c23
More cleanup.
Oct 14, 2020
ca11180
Cleaning up whitespaces.
Oct 14, 2020
6edf97a
Merge branch 'master' into JDK-8250768
Oct 14, 2020
26dcc5b
Post-merge fix.
Oct 14, 2020
6ba11d6
Updating build.
Oct 14, 2020
994cc72
Adding forgotten files.
Oct 15, 2020
ca78e89
Fixing tests.
Oct 15, 2020
a99bfe3
Merging master into JDK-8250768
Oct 15, 2020
42b5add
No, jdk.incubator.vector does not need jdk.internal package.
Oct 15, 2020
2d179d6
There is not jdk.internal package anymore
Oct 15, 2020
d23d55b
The Preview taglet is not needed anymore.
Oct 16, 2020
c50d5ec
Various cleanup.
Oct 16, 2020
efb37a9
Fixing tests.
Oct 16, 2020
9ce4b0a
Reflecting review comments.
Oct 19, 2020
30a9695
Merge branch 'master' into JDK-8250768
Oct 20, 2020
2b625f5
Using unique sections for preview warning sections, as suggested.
Oct 20, 2020
da4d41e
Fixing tests.
Oct 20, 2020
49b720d
More fixing tests.
Oct 20, 2020
be1d865
Merge branch 'JDK-8250768-dev' of https://github.com/lahodaj/jdk into…
Oct 20, 2020
34169e0
Reflecting review comments.
Oct 23, 2020
caa4fd3
Using a more correct way to get URLs.
Oct 23, 2020
461e7d1
Removing unnecessary cast.
Oct 23, 2020
deda85d
Merge branch 'master' into JDK-8250768
Oct 26, 2020
e238784
Reflecting review comments.
Oct 29, 2020
67e18e4
Merging master into JDK-8250768
Oct 29, 2020
35f2a78
Finalizing removal of record preview hooks.
Oct 29, 2020
cd4741e
Fixing tests.
Oct 29, 2020
d76eb29
Updating tests after records are a final feature.
Oct 29, 2020
a56fd33
Merging master into JDK-8250768.
Nov 2, 2020
2e40390
Removing trailing whitespace.
Nov 2, 2020
743f516
Reflecting review comments.
Nov 4, 2020
afba66a
Merging master into JDK-8250768-dev4
Nov 4, 2020
e4b0282
Cleanup - removing unnecessary code.
Nov 4, 2020
b9e1739
Removing unnecessary property keys.
Nov 5, 2020
3d55f90
Merging master into JDK-8250768
Nov 5, 2020
370031f
Removing obsolette @PreviewFeature.
Nov 5, 2020
097ae3c
Fixing typo.
Nov 5, 2020
61264fe
Fixing navigator for the PREVIEW page.
Nov 6, 2020
0c1c4d5
Merging recent master changes into JDK-8250768
Dec 8, 2020
4ccb150
Merging master into JDK-8250768
Jan 7, 2021
a8046dd
Fixing tests after a merge.
Jan 7, 2021
56371c4
Updating copyright years.
Jan 8, 2021
4f65495
Merging master into JDK-8250768
Jan 8, 2021
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

@@ -1,5 +1,5 @@
#
# Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2014, 2021, 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
@@ -49,8 +49,8 @@ TARGETS += $(patsubst %, $(BUILDTOOLS_OUTPUTDIR)/gensrc/%/module-info.java, \
$(INTERIM_LANGTOOLS_MODULES))

$(eval $(call SetupCopyFiles, COPY_PREVIEW_FEATURES, \
FILES := $(TOPDIR)/src/java.base/share/classes/jdk/internal/PreviewFeature.java, \
DEST := $(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim/jdk/internal/, \
FILES := $(TOPDIR)/src/java.base/share/classes/jdk/internal/javac/PreviewFeature.java, \
DEST := $(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim/jdk/internal/javac/, \
))

TARGETS += $(COPY_PREVIEW_FEATURES)
@@ -81,8 +81,8 @@ define SetupInterimModule
--module-path $(BUILDTOOLS_OUTPUTDIR)/interim_langtools_modules \
$$(INTERIM_LANGTOOLS_ADD_EXPORTS) \
--patch-module java.base=$(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim \
--add-exports java.base/jdk.internal=java.compiler.interim \
--add-exports java.base/jdk.internal=jdk.compiler.interim, \
--add-exports java.base/jdk.internal.javac=java.compiler.interim \
--add-exports java.base/jdk.internal.javac=jdk.compiler.interim, \
))

$1_DEPS_INTERIM := $$(addsuffix .interim, $$(filter \
@@ -89,7 +89,6 @@ JAVADOC_TAGS := \
-tag see \
-taglet build.tools.taglet.ExtLink \
-taglet build.tools.taglet.Incubating \
-taglet build.tools.taglet.Preview \
-tagletpath $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
$(CUSTOM_JAVADOC_TAGS) \
#
@@ -658,13 +658,16 @@ INTERIM_LANGTOOLS_ADD_EXPORTS := \
--add-exports java.base/jdk.internal.jmod=jdk.compiler.interim \
--add-exports java.base/jdk.internal.misc=jdk.compiler.interim \
--add-exports java.base/sun.invoke.util=jdk.compiler.interim \
--add-exports java.base/jdk.internal.javac=java.compiler.interim \
--add-exports java.base/jdk.internal.javac=jdk.compiler.interim \
#
INTERIM_LANGTOOLS_MODULES_COMMA := $(strip $(subst $(SPACE),$(COMMA),$(strip \
$(INTERIM_LANGTOOLS_MODULES))))
INTERIM_LANGTOOLS_ARGS := \
--limit-modules java.base,jdk.zipfs,$(INTERIM_LANGTOOLS_MODULES_COMMA) \
--add-modules $(INTERIM_LANGTOOLS_MODULES_COMMA) \
--module-path $(BUILDTOOLS_OUTPUTDIR)/interim_langtools_modules \
--patch-module java.base=$(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim \
$(INTERIM_LANGTOOLS_ADD_EXPORTS) \
#
JAVAC_MAIN_CLASS = -m jdk.compiler.interim/com.sun.tools.javac.Main

This file was deleted.

@@ -1112,20 +1112,32 @@ private void addGenericAttributes(FeatureDescription desc, List<CPInfo> constant

private Annotation createAnnotation(List<CPInfo> constantPool, AnnotationDescription desc) {
String annotationType = desc.annotationType;
Map<String, Object> values = desc.values;

if (PREVIEW_FEATURE_ANNOTATION.equals(annotationType)) {
if (PREVIEW_FEATURE_ANNOTATION_NEW.equals(annotationType)) {
//the non-public PreviewFeature annotation will not be available in ct.sym,
//replace with purely synthetic javac-internal annotation:
annotationType = PREVIEW_FEATURE_ANNOTATION_INTERNAL;
}

if (PREVIEW_FEATURE_ANNOTATION_OLD.equals(annotationType)) {
//the non-public PreviewFeature annotation will not be available in ct.sym,
//replace with purely synthetic javac-internal annotation:
annotationType = PREVIEW_FEATURE_ANNOTATION_INTERNAL;
values = new HashMap<>(values);
Boolean essentialAPI = (Boolean) values.remove("essentialAPI");
values.put("reflective", essentialAPI != null && !essentialAPI);
}

return new Annotation(null,
addString(constantPool, annotationType),
createElementPairs(constantPool, desc.values));
createElementPairs(constantPool, values));
}
//where:
private static final String PREVIEW_FEATURE_ANNOTATION =
private static final String PREVIEW_FEATURE_ANNOTATION_OLD =
"Ljdk/internal/PreviewFeature;";
private static final String PREVIEW_FEATURE_ANNOTATION_NEW =
"Ljdk/internal/javac/PreviewFeature;";
private static final String PREVIEW_FEATURE_ANNOTATION_INTERNAL =
"Ljdk/internal/PreviewFeature+Annotation;";

@@ -1,5 +1,5 @@
#
# Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015, 2021, 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
@@ -44,7 +44,7 @@ CT_MODULESOURCEPATH := $(call GetModuleSrcPath)
CT_DATA_DESCRIPTION += $(TOPDIR)/make/data/symbols/symbols

COMPILECREATESYMBOLS_ADD_EXPORTS := \
--add-exports java.base/jdk.internal=java.compiler.interim,jdk.compiler.interim \
--add-exports java.base/jdk.internal.javac=java.compiler.interim,jdk.compiler.interim \
--add-exports jdk.compiler.interim/com.sun.tools.javac.api=ALL-UNNAMED \
--add-exports jdk.compiler.interim/com.sun.tools.javac.code=ALL-UNNAMED \
--add-exports jdk.compiler.interim/com.sun.tools.javac.util=ALL-UNNAMED \
@@ -60,7 +60,6 @@ $(eval $(call SetupJavaCompilation, COMPILE_CREATE_SYMBOLS, \
DISABLED_WARNINGS := options, \
JAVAC_FLAGS := \
$(INTERIM_LANGTOOLS_ARGS) \
--patch-module java.base=$(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim \
$(COMPILECREATESYMBOLS_ADD_EXPORTS), \
))

@@ -1,5 +1,5 @@
#
# Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015, 2021, 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
@@ -58,7 +58,6 @@ $(eval $(call SetupJavaCompilation, COMPILE_CREATE_SYMBOLS, \
DISABLED_WARNINGS := options, \
JAVAC_FLAGS := \
$(INTERIM_LANGTOOLS_ARGS) \
--patch-module java.base=$(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim \
$(COMPILECREATESYMBOLS_ADD_EXPORTS), \
))

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 2021, 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
@@ -4387,13 +4387,6 @@ public String descriptorString() {
public native boolean isHidden();

/**
* {@preview Associated with sealed classes, a preview feature of the Java language.
*
* This method is associated with <i>sealed classes</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
*
* Returns an array containing {@code Class} objects representing the
* direct subinterfaces or subclasses permitted to extend or
* implement this class or interface if it is sealed. The order of such elements
@@ -4429,7 +4422,7 @@ public String descriptorString() {
* @jls 9.1 Interface Declarations
* @since 15
*/
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SEALED_CLASSES, essentialAPI=false)
@jdk.internal.javac.PreviewFeature(feature=jdk.internal.javac.PreviewFeature.Feature.SEALED_CLASSES, reflective=true)
@CallerSensitive
public Class<?>[] getPermittedSubclasses() {
Class<?>[] subClasses;
@@ -4469,13 +4462,6 @@ private boolean isDirectSubType(Class<?> c) {
}

/**
* {@preview Associated with sealed classes, a preview feature of the Java language.
*
* This method is associated with <i>sealed classes</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
*
* Returns {@code true} if and only if this {@code Class} object represents
* a sealed class or interface. If this {@code Class} object represents a
* primitive type, {@code void}, or an array type, this method returns
@@ -4489,7 +4475,7 @@ private boolean isDirectSubType(Class<?> c) {
* @jls 9.1 Interface Declarations
* @since 15
*/
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SEALED_CLASSES, essentialAPI=false)
@jdk.internal.javac.PreviewFeature(feature=jdk.internal.javac.PreviewFeature.Feature.SEALED_CLASSES, reflective=true)
@SuppressWarnings("preview")
public boolean isSealed() {
if (isArray() || isPrimitive()) {
@@ -23,7 +23,7 @@
* questions.
*/

package jdk.internal;
package jdk.internal.javac;

import java.lang.annotation.*;

@@ -51,7 +51,7 @@
*/
public Feature feature();

public boolean essentialAPI() default false;
public boolean reflective() default false;

public enum Feature {
// 8242284:
@@ -68,6 +68,10 @@
// necessary for PreviewFeature in JDK 16 to declare the enum constant.
RECORDS,
SEALED_CLASSES,
/**
* A key for testing.
*/
TEST,
Comment on lines +71 to +74

This comment has been minimized.

@jonathan-gibbons

jonathan-gibbons Nov 2, 2020
Contributor

Slightly weird

;
}
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2021, 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
@@ -138,10 +138,9 @@
jdk.incubator.foreign;
exports com.sun.security.ntlm to
java.security.sasl;
exports jdk.internal to // for @HotSpotIntrinsicCandidate
exports jdk.internal.javac to
java.compiler,
jdk.compiler,
jdk.incubator.vector,
jdk.jshell;
exports jdk.internal.access to
java.desktop,
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2021, 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
@@ -66,33 +66,19 @@
/** The modifier {@code static} */ STATIC,

/**
* {@preview Associated with sealed classes, a preview feature of the Java language.
*
* This enum constant is associated with <i>sealed classes</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
*
* The modifier {@code sealed}
* @since 15
*/
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SEALED_CLASSES,
essentialAPI=false)
@jdk.internal.javac.PreviewFeature(feature=jdk.internal.javac.PreviewFeature.Feature.SEALED_CLASSES,
reflective=true)
SEALED,

/**
* {@preview Associated with sealed classes, a preview feature of the Java language.
*
* This enum constant is associated with <i>sealed classes</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
*
* The modifier {@code non-sealed}
* @since 15
*/
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SEALED_CLASSES,
essentialAPI=false)
@jdk.internal.javac.PreviewFeature(feature=jdk.internal.javac.PreviewFeature.Feature.SEALED_CLASSES,
reflective=true)
NON_SEALED {
public String toString() {
return "non-sealed";
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2021, 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
@@ -199,12 +199,6 @@
}

/**
* {@preview Associated with sealed classes, a preview feature of the Java language.
*
* This method is associated with <i>sealed classes</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
* Returns the permitted classes of this class or interface
* element in declaration order.
*
@@ -215,8 +209,8 @@
*
* @since 15
*/
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SEALED_CLASSES,
essentialAPI=false)
@jdk.internal.javac.PreviewFeature(feature=jdk.internal.javac.PreviewFeature.Feature.SEALED_CLASSES,
reflective=true)
default List<? extends TypeMirror> getPermittedSubclasses() {
return List.of();
}
ProTip! Use n and p to navigate between commits in a pull request.