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

Rewrite String#copyValueOf(char[]) to new String(char[]) #1001

Closed
1 of 3 tasks
rickie opened this issue Jan 28, 2024 · 7 comments · Fixed by #1012
Closed
1 of 3 tasks

Rewrite String#copyValueOf(char[]) to new String(char[]) #1001

rickie opened this issue Jan 28, 2024 · 7 comments · Fixed by #1012
Milestone

Comments

@rickie
Copy link
Member

rickie commented Jan 28, 2024

Problem

Rewrite String#copyValueOf(char[]) to new String(char[]).

Description of the proposed new feature

  • Support a stylistic preference.
  • Avoid a common gotcha, or potential problem.
  • Improve performance.

The Refaster rule should live in the StringRules file.
Make sure to add a test entry in the StringRulesTestInput and StringRulesTestOutput 😄.

I would like to rewrite the following code:

char[] foo = new char[0]; 
String s = String.copyValueOf(foo);

to:

char[] foo = new char[0]; 
String s = new String(foo);
@BLasan
Copy link
Contributor

BLasan commented Jan 31, 2024

Hi,

Will start working on this.

Thanks,
Benura

@BLasan
Copy link
Contributor

BLasan commented Feb 2, 2024

HI @rickie ,

Is there a slack channel or any other way to communicate installation issues? I'm facing some issues when running mvn clean install regarding some jars not found.

Thanks,
Benura

@BLasan
Copy link
Contributor

BLasan commented Feb 2, 2024

Hi @rickie ,

When running mvn clean install, it gives the below error.
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: The following artifacts could not be resolved: tech.picnic.error-prone-support:error-prone-contrib:jar:2.24.1 (absent), tech.picnic.error-prone-support:refaster-runner:jar:2.24.1 (absent): tech.picnic.error-prone-support:error-prone-contrib:jar:2.24.1 was not found in https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced

I'm using maven 3.9.5 and java 11.0.16.

Thanks,
Benura

@Stephan202
Copy link
Member

Stephan202 commented Feb 2, 2024

Hey @BLasan! Unfortunately we don't have a Slack channel. But we can use this issue thread to sync :)

W.r.t. your question: it looks like you mixed up some version numbers: version 2.24.1 is the version of Error Prone, while the tech.picnic.error-prone-support:* artifacts for which you get are error are for Error Prone Support (this project), of which the most recent version is 0.14.0.

That said: if you tried to build an unmodified version of this project, then it shouldn't be necessary to modify pom.xml at all. If you're still stuck, feel free to share the code you have so far :)

@BLasan
Copy link
Contributor

BLasan commented Feb 3, 2024

Hi @Stephan202 ,

Thanks for the prompt response. It worked for me without the pom.xml modifications. If it's not needed, shall we remove it from the README?

Thanks,
Benura

@Stephan202
Copy link
Member

Hey @BLasan! The README instructions are for people that want to use this library (i.e., include it in their own project), while you're currently trying to contribute to this library. For the latter the usual contribution workflow should be followed; for the former those README instructions are very much needed :)

Hope that clears things up! Cheers :)

BLasan added a commit to BLasan/error-prone-support that referenced this issue Feb 3, 2024
@BLasan
Copy link
Contributor

BLasan commented Feb 3, 2024

Hey @BLasan! The README instructions are for people that want to use this library (i.e., include it in their own project), while you're currently trying to contribute to this library. For the latter the usual contribution workflow should be followed; for the former those README instructions are very much needed :)

Hope that clears things up! Cheers :)

Thanks for the detailed explanation :)

rickie pushed a commit to BLasan/error-prone-support that referenced this issue Feb 10, 2024
@Stephan202 Stephan202 added this to the 0.15.0 milestone Feb 10, 2024
rickie pushed a commit to BLasan/error-prone-support that referenced this issue Feb 11, 2024
rickie pushed a commit to BLasan/error-prone-support that referenced this issue Feb 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants