-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-2228: (Non-static) polyfills throwing exception in case of several…
… polyfills for same type per project (#2229) * tentative fix for the bug * add a test * alternative approach (experimental)
- Loading branch information
Showing
6 changed files
with
95 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...lipse.n4js.xpect.tests/xt-tests/polyfill/GH_2228_SeveralPolyfillsForSameType/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "Test", | ||
"version": "0.0.1", | ||
"n4js": { | ||
"projectType": "runtimeLibrary", | ||
"vendorId": "org.eclipse.n4js", | ||
"vendorName": "Eclipse N4JS Project", | ||
"sources": { | ||
"source": [ | ||
"src" | ||
] | ||
} | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
....n4js.xpect.tests/xt-tests/polyfill/GH_2228_SeveralPolyfillsForSameType/src/Main.n4jsd.xt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (c) 2019 NumberFour AG. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* NumberFour AG - Initial API and implementation | ||
*/ | ||
|
||
/* XPECT_SETUP org.eclipse.n4js.xpect.tests.N4jsXtTest | ||
Workspace { | ||
Project "Test" { | ||
Folder "src" { | ||
File "Other.n4jsd" { from="./Other.n4jsd" } | ||
ThisFile {} | ||
} | ||
File "package.json" { from="../package.json" } | ||
} | ||
} | ||
END_SETUP | ||
*/ | ||
|
||
@@Global @@ProvidedByRuntime | ||
|
||
// XPECT noerrors --> | ||
@Polyfill export external public class Array<T> extends Array<T> { | ||
// no members required here | ||
} | ||
|
||
// before the bug fix the following exception was thrown: | ||
// | ||
// Caused by: java.lang.IllegalArgumentException: name may not be null | ||
// at org.eclipse.n4js.ts.types.util.NameStaticPair.<init>(NameStaticPair.java:48) | ||
// at org.eclipse.n4js.ts.types.util.NameStaticPair.<init>(NameStaticPair.java:40) | ||
// at org.eclipse.n4js.ts.types.util.NameStaticPair.of(NameStaticPair.java:33) | ||
// at org.eclipse.n4js.validation.utils.MemberCube.addMembers(MemberCube.java:52) | ||
// at org.eclipse.n4js.validation.utils.MemberCube.<init>(MemberCube.java:43) | ||
// at org.eclipse.n4js.validation.validators.N4JSMemberRedefinitionValidator.createMemberValidationList(N4JSMemberRedefinitionValidator.java:1278) | ||
// at org.eclipse.n4js.validation.validators.N4JSMemberRedefinitionValidator.checkMemberRedefinitions(N4JSMemberRedefinitionValidator.java:189) | ||
// at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | ||
// at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) | ||
// at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) | ||
// at java.base/java.lang.reflect.Method.invoke(Method.java:566) | ||
// at org.eclipse.xtext.validation.AbstractDeclarativeValidator$MethodWrapper.invoke(AbstractDeclarativeValidator.java:129) | ||
// at org.eclipse.n4js.validation.N4JSValidator$N4JSMethodWrapperCancelable.invoke(N4JSValidator.java:105) | ||
// ... 32 more |
16 changes: 16 additions & 0 deletions
16
...se.n4js.xpect.tests/xt-tests/polyfill/GH_2228_SeveralPolyfillsForSameType/src/Other.n4jsd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright (c) 2021 NumberFour AG. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* NumberFour AG - Initial API and implementation | ||
*/ | ||
|
||
@@Global @@ProvidedByRuntime | ||
|
||
@Polyfill export external public class Array<T> extends Array<T> { | ||
public [Symbol.hasInstance](): any+; | ||
} |