Skip to content

Commit 8cf4fe9

Browse files
committed
JBR-8602 Migrate JBR API backend to Classfile API
1 parent 56becfb commit 8cf4fe9

19 files changed

+934
-792
lines changed

src/java.base/share/classes/com/jetbrains/bootstrap/JBRApiBootstrap.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2000-2023 JetBrains s.r.o.
2+
* Copyright 2025 JetBrains s.r.o.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
2525

2626
package com.jetbrains.bootstrap;
2727

28-
import com.jetbrains.internal.JBRApi;
28+
import com.jetbrains.internal.jbrapi.JBRApi;
2929

3030
import java.lang.invoke.MethodHandles;
3131
import java.util.Map;

src/java.base/share/classes/com/jetbrains/exported/JBRApi.java

+26-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
/*
2+
* Copyright 2025 JetBrains s.r.o.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
126
package com.jetbrains.exported;
227

328
import jdk.internal.reflect.CallerSensitive;
@@ -66,7 +91,7 @@ private JBRApi() {}
6691
public static <T> T internalService() {
6792
var caller = (Class<T>) Reflection.getCallerClass();
6893
if (caller == null) throw new IllegalCallerException("No caller frame");
69-
return com.jetbrains.internal.JBRApi.getInternalService(caller);
94+
return com.jetbrains.internal.jbrapi.JBRApi.getInternalService(caller);
7095
}
7196

7297
/**

src/java.base/share/classes/com/jetbrains/exported/JBRApiSupport.java

+31-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,32 @@
1+
/*
2+
* Copyright 2025 JetBrains s.r.o.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
126
package com.jetbrains.exported;
227

28+
import com.jetbrains.internal.jbrapi.JBRApi;
29+
330
import java.lang.annotation.Annotation;
431
import java.lang.invoke.CallSite;
532
import java.lang.invoke.ConstantCallSite;
@@ -32,22 +59,22 @@ public static synchronized Object bootstrap(Class<?> apiInterface,
3259
Class<? extends Annotation> providesAnnotation,
3360
Map<Enum<?>, Class[]> knownExtensions,
3461
Function<Method, Enum<?>> extensionExtractor) {
35-
if (!com.jetbrains.internal.JBRApi.ENABLED) return null;
36-
com.jetbrains.internal.JBRApi.init(
62+
if (!JBRApi.ENABLED) return null;
63+
JBRApi.init(
3764
null,
3865
serviceAnnotation,
3966
providedAnnotation,
4067
providesAnnotation,
4168
knownExtensions,
4269
extensionExtractor);
43-
return com.jetbrains.internal.JBRApi.getService(apiInterface);
70+
return JBRApi.getService(apiInterface);
4471
}
4572

4673
/**
4774
* Bootstrap method for JBR API dynamic invocations.
4875
*/
4976
public static CallSite bootstrapDynamic(MethodHandles.Lookup caller, String name, MethodType type) {
50-
return new ConstantCallSite(com.jetbrains.internal.JBRApi.bindDynamic(caller, name, type));
77+
return new ConstantCallSite(JBRApi.bindDynamic(caller, name, type));
5178
}
5279

5380
/**

src/java.base/share/classes/com/jetbrains/internal/ASMUtils.java

-136
This file was deleted.

src/java.base/share/classes/com/jetbrains/internal/AccessContext.java

-140
This file was deleted.

0 commit comments

Comments
 (0)