Skip to content

Commit

Permalink
Build the JSpecify JDK (#114)
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Povirk <[email protected]>
  • Loading branch information
wmdietl and cpovirk authored Dec 17, 2024
1 parent 300a39f commit c9befbc
Show file tree
Hide file tree
Showing 341 changed files with 2,142 additions and 12,340 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/jspecify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: JSpecify JDK CI tests

on:
pull_request:
push:
branches: [ "main" ]

jobs:
build_jdk:
name: Build the JSpecify JDK
runs-on: ubuntu-latest
permissions:
contents: read
env:
JAVA_VERSION: 23
steps:
- uses: actions/checkout@v4
- name: Set up JDK 23
uses: actions/setup-java@v4
with:
java-version: 23
distribution: 'temurin'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install --only-upgrade apt
sudo apt-get install gcc-10 g++-10 libxrandr-dev libxtst-dev libcups2-dev libasound2-dev
- name: Install jtreg
run: |
wget https://builds.shipilev.net/jtreg/jtreg-7.5%2B1.zip -O /tmp/jtreg.zip
unzip /tmp/jtreg.zip -d /tmp/
- name: Configure the JDK
run: bash ./configure --with-jtreg=/tmp/jtreg --disable-warnings-as-errors
- name: Build the JDK
run: make jdk

10 changes: 7 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ on:
inputs:
platforms:
description: 'Platform(s) to execute on (comma separated, e.g. "linux-x64, macos, aarch64")'
required: true
default: 'linux-x64, linux-x64-variants, linux-cross-compile, alpine-linux-x64, macos-x64, macos-aarch64, windows-x64, windows-aarch64, docs'
required: false
default: ''
# default: 'linux-x64, linux-x64-variants, linux-cross-compile, alpine-linux-x64, macos-x64, macos-aarch64, windows-x64, windows-aarch64, docs'
configure-arguments:
description: 'Additional configure arguments'
required: false
Expand Down Expand Up @@ -120,7 +121,9 @@ jobs:
return
fi
done
echo 'true'
# echo 'true'
# WMD: Assume empty means no platforms
echo 'false'
return
else
# Check for all acceptable platform names
Expand Down Expand Up @@ -163,6 +166,7 @@ jobs:
uses: ./.github/workflows/build-linux.yml
with:
platform: linux-x64
debug-levels: '[ "debug" ]'
gcc-major-version: '10'
configure-arguments: ${{ github.event.inputs.configure-arguments }}
make-arguments: ${{ github.event.inputs.make-arguments }}
Expand Down
Binary file removed checker-qual.jar
Binary file not shown.
15 changes: 0 additions & 15 deletions createjdkJAR.sh

This file was deleted.

5 changes: 5 additions & 0 deletions make/CompileInterimLangtools.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ TARGETS += $(COPY_PREVIEW_FEATURES)
# would require the source files to be copied into directories named after the
# actual interim modules.

## DON'T PUT COMMAS within this macro definition, as in
# --add-exports java.base/org.checkerframework.checker.builder.qual=java.compiler.interim,jdk.compiler.interim \

# Param 1 - Name of module to compile
define SetupInterimModule
$$(eval $$(call SetupJavaCompilation, BUILD_$1.interim, \
Expand All @@ -112,6 +115,8 @@ define SetupInterimModule
DISABLED_WARNINGS := module options, \
JAVAC_FLAGS := \
--module-path $(BUILDTOOLS_OUTPUTDIR)/interim_langtools_modules \
-cp $(TOPDIR)/src/java.base/share/classes/ \
--add-reads $1.interim=ALL-UNNAMED \
$$(INTERIM_LANGTOOLS_ADD_EXPORTS) \
--patch-module java.base=$(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim \
--add-exports java.base/jdk.internal.javac=java.compiler.interim \
Expand Down
4 changes: 4 additions & 0 deletions make/CopyInterimTZDB.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ define tzdb_copyfiles
$(call MakeTargetDir)
$(RM) '$@'
$(SED) -e "s/package java.time.zone/package build.tools.tzdb/" \
-e "s/import org.jspecify.annotations.NullMarked;//" \
-e "s/import org.jspecify.annotations.Nullable;//" \
-e "s/@NullMarked//" \
-e "s/@Nullable //" \
< $(<) > $@
endef

Expand Down
1 change: 1 addition & 0 deletions make/autoconf/spec.gmk.template
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@ INTERIM_LANGTOOLS_ARGS := \
--add-modules $(INTERIM_LANGTOOLS_MODULES_COMMA) \
--module-path $(BUILDTOOLS_OUTPUTDIR)/interim_langtools_modules \
--patch-module java.base=$(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim \
-cp $(TOPDIR)/src/java.base/share/classes/ \
$(INTERIM_LANGTOOLS_ADD_EXPORTS) \
#
JAVAC_MAIN_CLASS := -m jdk.compiler.interim/com.sun.tools.javac.Main
Expand Down
2 changes: 1 addition & 1 deletion make/common/JavaCompilation.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ define SetupJavaCompilationBody
endif

# Allow overriding on the command line
JAVA_WARNINGS_ARE_ERRORS ?= -Werror
JAVA_WARNINGS_ARE_ERRORS ?=

# Tell javac to do exactly as told and no more
PARANOIA_FLAGS := -implicit:none -Xprefer:source -XDignore.symbol.file=true -encoding ascii
Expand Down
4 changes: 2 additions & 2 deletions make/langtools/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
#

#javac configuration for "normal build" (these will be passed to the bootstrap compiler):
javac.opts = -XDignore.symbol.file=true -Xlint:all,-deprecation,-exports -Werror -g:source,lines,vars
javac.opts = -XDignore.symbol.file=true -Xlint:all,-deprecation,-exports -g:source,lines,vars

#version used to compile build tools
javac.build.opts = -XDignore.symbol.file=true -Xlint:all,-deprecation,-options -Werror -g:source,lines,vars
javac.build.opts = -XDignore.symbol.file=true -Xlint:all,-deprecation,-options -g:source,lines,vars
javac.build.source = 8
javac.build.target = 8

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2613,6 +2613,10 @@ private boolean readAttribute(ClassFile cf, FeatureDescription feature, Attribut
((MethodDescription) feature).classParameterAnnotations =
parameterAnnotations2Description(cf.constant_pool, attr);
break;
case "RuntimeInvisibleTypeAnnotations":
case "RuntimeVisibleTypeAnnotations":
// TODO(wmdietl): What should happen to type annotations?
break;
case Attribute.Module: {
assert feature instanceof ModuleHeaderDescription;
ModuleHeaderDescription header =
Expand Down
3 changes: 3 additions & 0 deletions src/java.base/share/classes/java/io/DataOutputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@

import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

import jdk.internal.access.JavaLangAccess;
import jdk.internal.access.SharedSecrets;
import jdk.internal.util.ByteArray;

import static jdk.internal.util.ModifiedUtf.putChar;
Expand Down
4 changes: 2 additions & 2 deletions src/java.base/share/classes/java/lang/Runtime.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
*/

@NullMarked
public class Runtime {
public class Runtime {
private static final Runtime currentRuntime = new Runtime();

private static Version version;
Expand Down Expand Up @@ -177,7 +177,6 @@ private Runtime() {}
* @see #removeShutdownHook
* @see #halt(int)
*/

public void exit(int status) {
Shutdown.exit(status);
}
Expand Down Expand Up @@ -368,6 +367,7 @@ public Process exec(String command) throws IOException {
* @see #exec(String[], String[], File)
* @see ProcessBuilder
*/
@Deprecated(since="18")
public Process exec(String command, String @Nullable [] envp) throws IOException {
return exec(command, envp, null);
}
Expand Down
1 change: 0 additions & 1 deletion src/java.base/share/classes/java/net/DatagramSocket.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

package java.net;

import org.checkerframework.checker.interning.qual.UsesObjectEquals;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

Expand Down
6 changes: 1 addition & 5 deletions src/java.base/share/classes/java/nio/file/Files.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@

package java.nio.file;

import org.checkerframework.checker.interning.qual.UsesObjectEquals;
import org.checkerframework.checker.signedness.qual.PolySigned;
import org.checkerframework.framework.qual.AnnotatedFor;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.Closeable;
Expand Down Expand Up @@ -3173,7 +3169,7 @@ public static List<String> readAllLines(Path path) throws IOException {
* StandardOpenOption#CREATE_NEW CREATE_NEW} option is specified
* <i>(optional specific exception)</i>
*/
public static Path write(Path path, @PolySigned byte[] bytes, OpenOption... options)
public static Path write(Path path, byte[] bytes, OpenOption... options)
throws IOException
{
// ensure bytes is not null before opening file
Expand Down
Loading

0 comments on commit c9befbc

Please sign in to comment.