Skip to content
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

fix PTBKey updateWhenSettingTypeAnnotations #3436

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jukzi
Copy link
Contributor

@jukzi jukzi commented Dec 11, 2024

Changing PTBKey.arguments[idx] changes PTBKey.equals() and PTBKey.hashCode().
So the old PTBKey has to be removed and a new has to be inserted. It was wrong to keep the PTBKey in hashedParameterizedTypes. Found by codereview. It is not clear if that could produce an error other then having bad performance by having garbage entries in the HashMap that could furthermore not found because the hash/equals contract was violated.

Code is executed for example during
compiler.apt.tests.Java8ElementsTests.testTypeAnnotations()

relates to
#3412

Changing PTBKey.arguments[idx] changes PTBKey.equals() and
PTBKey.hashCode().
So the old PTBKey has to be removed and a new has to be inserted.
It was wrong to keep the PTBKey in hashedParameterizedTypes. Found by
codereview. It is not clear if that could produce an error other then
having bad performance by having garbage entries in the HashMap that
could furthermore not found because the hash/equals contract was
violated.

Code is executed for example during
compiler.apt.tests.Java8ElementsTests.testTypeAnnotations()

relates to
eclipse-jdt#3412
@jukzi jukzi added bug Something isn't working performance labels Dec 11, 2024
@jukzi jukzi marked this pull request as draft December 11, 2024 14:51
@jukzi
Copy link
Contributor Author

jukzi commented Dec 11, 2024

failed

1. ERROR in abc\d\DMessageHandlerRegistryImpl.java (at line 4)\r\n
	public class DMessageHandlerRegistryImpl<@NonNull C extends DConnection>\r\n
	             ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n
The interface MessageHandlerRegistry cannot be implemented more than once with different arguments: 
MessageHandlerRegistry<C,CharSequence,DIncomingMessageData> and 
MessageHandlerRegistry<C,CharSequence,DIncomingMessageData>\n
]>
	at org.eclipse.jdt.core.tests.junit.extension.TestCase.assertStringEquals(TestCase.java:265)
	at org.eclipse.jdt.core.tests.junit.extension.TestCase.assertEquals(TestCase.java:240)
	at org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.runTest(AbstractRegressionTest.java:3600)
	at org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.runTest(AbstractRegressionTest.java:3405)
	at org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest$Runner.runConformTest(AbstractRegressionTest.java:126)
	at org.eclipse.jdt.core.tests.compiler.regression.NullTypeAnnotationTest.testGH2158(NullTypeAnnotationTest.java:19313)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants