-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[apex] [7.0-rc1] Exception while initializing Apexlink (Index 34812 out of bounds for length 34812) #4453
Comments
same issue for me with 7.0.0-rc3
|
@nawforce can you take a look at this? |
Sorry for delay on this. The issue I think is the encoding on Windows is not UTF-8, you could try using -Dfile.encoding=UTF-8 as a temporary hack. To really get rid of this we will need the update that is pending on #4528. |
I don't think #4528 will solve this issue - apexlink currently expects that the apex source code in encoded in UTF-8. Until this is solved, you have two options: a) Use UTF-8 for all your source code, b) disable the apex rule "UnusedMethod". I figured out, that we don't have a single unit test for the rule UnusedMethod - that means I can't proof anything, but looking at https://github.com/nawforce/apex-link/blob/7688adcb7a2d7f8aa28d0618ffb2a3aa81151858/pkgforce/jvm/src/main/scala/com/nawforce/runtime/parsers/SourceData.scala#L36-L49 I think, apexlink still expects UTF-8. It might change however with "apex-dev-tools". For Java (or in general), we have the (cli) option |
I was able to reproduce the issue now - The conditions are:
Therefore, the workaround is indeed, to force the JVM's default charset to be UTF-8, e.g. when using the PMD CLI, you can set the env variable I could verify, that this problem is indeed fixed by #4528 . The new version of apexlink now always uses UTF-8 (also for the antlr charstream, see https://github.com/nawforce/apex-link/blob/7688adcb7a2d7f8aa28d0618ffb2a3aa81151858/pkgforce/jvm/src/main/scala/com/nawforce/runtime/parsers/SourceData.scala#L55-L59 ) and doesn't depend anymore on the platform encoding. FYI: This issue will be closed once #4610 is merged. |
Affects PMD Version:
7.0.0-rc1
Make sure, to test with the latest PMD version.
Description:
Unable to utilize rule UnusedMethod
Exception Stacktrace:
Code Sample demonstrating the issue:
Steps to reproduce:
Please provide detailed steps for how we can reproduce the bug.
mvn clean verify
)pmd check -dir force-app\main\default\classes -R category/apex/design.xml/UnusedMethod -f text -v
Running PMD through: [CLI]
openjdk 17.0.6 2023-01-17
OpenJDK Runtime Environment Temurin-17.0.6+10 (build 17.0.6+10)
OpenJDK 64-Bit Server VM Temurin-17.0.6+10 (build 17.0.6+10, mixed mode, sharing)
The text was updated successfully, but these errors were encountered: