-
Notifications
You must be signed in to change notification settings - Fork 859
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
Skip importing same class twice (fixes #1463) #1676
base: master
Are you sure you want to change the base?
Conversation
See #1463 - I would like to have a testcase for this situation ;) |
So, do you have an idea how to test? Or do we feel that existing tests cover this well enough? |
I found one case, where I can trigger that error: importPackage(java.util);
UUID.randomUUID(); // calls getPkgProperty("UUID", global, false)
importClass(java.util.UUID);
UUID.randomUUID(); While the first access calls synchronized Object getPkgProperty(String name, Scriptable start, boolean createPkg) {
Object cached = super.get(name, start);
if (cached != NOT_FOUND) return cached;
// TODO: check start.getParentScope() I doubt, that the above use case is the same case as @Easy65 had, as this code fails also in 1.7.11. |
Sorry, I've run out of ideas on how to write a test case that shows the regression between 1.7.11 and the current version. I tried different things, shared scopes etc., but either the test fails under both 1.7.11 and current version or passes under both versions. If no further input comes in, then I would merge this, as it is an improvement. |
Hi, I could finally provide a test, see my latest comment in the issue. |
Thanks for the test. I'll try to convert this to a unittest the next days |
@@ -40,12 +41,10 @@ public void setUp() throws Exception { | |||
} | |||
|
|||
ctx = Context.enter(); | |||
scope1 = ctx.newObject(sharedScope); | |||
scope1 = new NativeObject(); |
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.
This was done too complex
No description provided.