-
Notifications
You must be signed in to change notification settings - Fork 389
Fix compile errors for records with custom constructors, update JDT #10358
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -248,6 +248,54 @@ public class JavaResourceBase { | |
| "package java.util;", | ||
| "public interface Map<K,V> { }"); | ||
|
|
||
| public static final MockJavaResource METHOD_HANDLE = | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Going over the rest of GWT, I don't see actual emulation for these provided, so how does a normal compile have these (or not need them) while a test must get them from here? I do see com.google.gwt.dev.javac.JdtCompiler.INameEnvironmentImpl#getLambdaMetafactoryBytes and friends, but nothing that provides MethodHandle or MethodHandles itself, nor StringConcatFactory. Does the newer JDT require these so we'll want general emulation for these, or maybe these were needed for an earlier iteration but no longer (e.g. to try to deal with emulating Record method before Objects was added)? |
||
| createMockJavaResource("java.lang.invoke.MethodHandle", | ||
| """ | ||
| package java.lang.invoke; | ||
| public abstract class MethodHandle { } | ||
| """); | ||
|
|
||
| public static final MockJavaResource METHOD_HANDLES = | ||
| createMockJavaResource("java.lang.invoke.MethodHandles", | ||
| """ | ||
| package java.lang.invoke; | ||
| public class MethodHandles { | ||
| public static final class Lookup { | ||
| public MethodHandle findVirtual(Class<?> refc, String name, | ||
| MethodType type) { | ||
| return null; | ||
| } | ||
|
|
||
| public MethodHandle findStatic(Class<?> refc, String name, | ||
| MethodType type) { | ||
| return null; | ||
| } | ||
| } | ||
|
|
||
| public static Lookup lookup() { | ||
| return null; | ||
| } | ||
| } | ||
| """); | ||
|
|
||
| public static final MockJavaResource METHOD_TYPE = | ||
| createMockJavaResource("java.lang.invoke.MethodType", | ||
| """ | ||
| package java.lang.invoke; | ||
| public final class MethodType { | ||
| public static MethodType methodType(Class<?> rtype, Class<?> ptype0, | ||
| Class<?>... ptypes) { | ||
| return null; | ||
| } | ||
| public static MethodType methodType(Class<?> rtype) { | ||
| return null; | ||
| } | ||
| public static MethodType genericMethodType(int objectArgCount) { | ||
| return null; | ||
| } | ||
| } | ||
| """); | ||
|
|
||
| public static final MockJavaResource NO_CLASS_DEF_FOUND_ERROR = | ||
| createMockJavaResource("java.lang.NoClassDefFoundError", | ||
| "package java.lang;", | ||
|
|
@@ -364,6 +412,13 @@ public class JavaResourceBase { | |
| "public final class StringBuilder {", | ||
| "}"); | ||
|
|
||
| public static final MockJavaResource STRING_CONCAT_FACTORY = | ||
| createMockJavaResource("java.lang.invoke.StringConcatFactory", | ||
| """ | ||
| package java.lang.invoke; | ||
| public final class StringConcatFactory {} | ||
| """); | ||
|
|
||
| public static final MockJavaResource SUPPRESS_WARNINGS = | ||
| createMockJavaResource("java.lang.SuppressWarnings", | ||
| "package java.lang;", | ||
|
|
@@ -467,7 +522,8 @@ public static MockJavaResource[] getStandardResources() { | |
| AUTOCLOSEABLE, ANNOTATION, ARRAY_LIST, BYTE, BOOLEAN, CHARACTER, CHAR_SEQUENCE, CLASS, | ||
| CLASS_NOT_FOUND_EXCEPTION, CLONEABLE, COLLECTION, COMPARABLE, DOUBLE, ENUM, EXCEPTION, | ||
| ERROR, FUNCTIONALINTERFACE, FLOAT, INTEGER, IS_SERIALIZABLE, JAVASCRIPTEXCEPTION, | ||
| JAVASCRIPTOBJECT, LIST, LONG, MAP, NO_CLASS_DEF_FOUND_ERROR, NUMBER, OBJECT, OBJECTMETHODS, | ||
| JAVASCRIPTOBJECT, LIST, LONG, MAP, METHOD_HANDLES, NO_CLASS_DEF_FOUND_ERROR, | ||
| NUMBER, OBJECT, OBJECTMETHODS, METHOD_HANDLE, METHOD_TYPE, STRING_CONCAT_FACTORY, | ||
| OBJECTS, RECORD, RUNTIME_EXCEPTION, SERIALIZABLE, SHORT, STRING, STRING_BUILDER, | ||
| SUPPRESS_WARNINGS, SYSTEM, THROWABLE, SPECIALIZE_METHOD, DO_NOT_AUTOBOX, JSTYPE, | ||
| JSCONSTRUCTOR, JSPACKAGE, JSPROPERTY, JSMETHOD, JSIGNORE, JSFUNCTION, JSOVERLAY, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that JSPs don't work any more in dev mode? Did they before this patch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, if you either stick with Java 1.7 syntax or provide your own
web.xml.If you provide your own
web.xml(setting Java level to 1.8 or higher), they should still work. Without it, they will fail.I wasn't sure what we want (could we break something by creating
web.xmlfor projects that don't need it?)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, so need a release note entry on this, that 1.7 won't work any more, and newer formats require an explicit web.xml entry.