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

A proposal for OpcodeStack.Item#defineNewSpecialKind() #86

Closed

Conversation

KengoTODA
Copy link
Contributor

It seems that current implementation has two problems:

  1. defineNewSpecialKind(String) method returns an int value which is not same with actual newly defined SpecialKind
  2. specialKindNames field is not thread-safe, even though it is annotated with @StaticConstant so it will be shared between analysis runs.

Are they intended behaviour? Here I will propose JUnit tests to explain the first problem, and new implementation to solve both of two problems. Could you check it, please?
Note that this PR changes type of specialKindNames public field. If we should keep it, we can use synchronised block instead of ConcurrentMap.

KengoTODA added a commit to KengoTODA/spotbugs that referenced this pull request Nov 10, 2016
1. defineNewSpecialKind(String) method returns an int value which is not same with actual newly defined SpecialKind
2. specialKindNames field is not thread-safe, even though it is annotated with @StaticConstant so it will be shared between analysis runs.

refs findbugsproject/findbugs#86

Squashed commit of the following:

commit bb10ef2bd8ee4816f7b6bc0c4f4e855b9de5b144
Author: Kengo TODA <skypencil@gmail.com>
Date:   Fri Feb 19 05:29:35 2016 +0800

    improve javadoc

commit 3ead4633ec81aafbbe744f16d9bdaaf572b059ef
Author: Kengo TODA <skypencil@gmail.com>
Date:   Fri Feb 19 05:20:21 2016 +0800

    bugfix: StaticConstant should be threadsafe

commit 5fae95bd38d56a0620edf094af3cca864b10023b
Author: Kengo TODA <skypencil@gmail.com>
Date:   Fri Feb 19 05:16:28 2016 +0800

    change behaviour of #defineNewSpecialKind(String) to make it intuitive

commit 8e8de1fc958beca01205d93acb94e5d1a3ae7aa6
Author: Kengo TODA <skypencil@gmail.com>
Date:   Fri Feb 19 05:12:52 2016 +0800

    reproduce strange behavior
@iloveeclipse
Copy link
Member

I have no idea about this code and the mentioned change.

@iloveeclipse
Copy link
Member

Closing as merged in SpotBugs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants