Comments (7)
An even worse case:
Using a static method call inside a String template expression, e.g.
String text = "${StringUtils.substring(value, 1)}"
If StringUtils
class is not used elsewhere, it is marked as unused. If configured in IntelliJ, it gets removed automatically from the list of imports, resulting in a compilation failure.
from manifold-ij.
I am not seeing any of this, all of this is implemented.
What version of the plugin / IJ / etc. are you using?
from manifold-ij.
Latest version of everything:
- Manifold plugin: 2024.1.5
- IntelliJ IDEA 2024.1.2 (Community Edition)
This also happens for me with the sample project:
from manifold-ij.
Looking at your earlier screenshots, it appears string templates aren't really enabled, for instance local var usage s/b highlighted. This is probably the root of the problem. Can you provide your build file[s]? A simple change will probably fix things up for you.
from manifold-ij.
It is enabled. Using the manifold-strings-test
project (I didn't change anything), all tests pass successfully, but the 'never used' warning is still present.
Edit:
For some reason, it's highlighted now and the warning dissapeared.
However, it's not fixed everywhere. Method parameters still don't get marked as being used:
So now I'm not sure anymore what the config should be. When looking at the documentation, I see that only an annotated processor is added:
<annotationProcessorPaths>
<path>
<groupId>systems.manifold</groupId>
<artifactId>manifold-strings</artifactId>
<version>${manifold.version}</version>
</path>
</annotationProcessorPaths>
However, I don't see this in the manifold-strings-test
project; it is only added as a dependency.
As a test, I've added them both, but it didn't change anything:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<manifold.version>2024.1.17</manifold.version>
<maven.compiler.source>22</maven.compiler.source>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<encoding>UTF-8</encoding>
<compilerArgs>
<arg>-Xplugin:Manifold</arg>
</compilerArgs>
<annotationProcessorPaths>
<path>
<groupId>systems.manifold</groupId>
<artifactId>manifold-strings</artifactId>
<version>${manifold.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>systems.manifold</groupId>
<artifactId>manifold-strings</artifactId>
<version>${manifold.version}</version>
</dependency>
</dependencies>
</project>
It looks like only the dependency is needed, not the annotationProcessorPath.
edit2: It does work when I add it in the manifold-strings-test
project:
from manifold-ij.
Yeah, most of the test modules aren't setup for IntelliJ use. Always refer to the setup docs for manifold features. In this case, see the manifold-strings setup docs. Also see the android docs if you're working in that environment.
from manifold-ij.
I have the same issue. Intellij thinks a static function that's used in a string template as unused, and removes it when organizing imports. Intellij manifold plugin version 2024.1.6, pom.xml:
<properties>
<manifold.version>2024.1.21</manifold.version>
</properties>
<dependencies>
<dependency>
<groupId>systems.manifold</groupId>
<artifactId>manifold-ext-rt</artifactId>
<version>${manifold.version}</version>
</dependency>
<dependency>
<groupId>systems.manifold</groupId>
<artifactId>manifold-rt</artifactId>
<version>${manifold.version}</version>
</dependency>
<dependency>
<groupId>systems.manifold</groupId>
<artifactId>manifold-collections</artifactId>
<version>${manifold.version}</version>
</dependency>
<dependency>
<groupId>systems.manifold</groupId>
<artifactId>manifold-strings</artifactId>
<version>${manifold.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>17</source>
<target>17</target>
<encoding>UTF-8</encoding>
<compilerArgs>
<!-- Configure manifold plugin -->
<arg>-Xplugin:Manifold</arg>
</compilerArgs>
<annotationProcessorPaths>
<path>
<groupId>systems.manifold</groupId>
<artifactId>manifold</artifactId>
<version>${manifold.version}</version>
</path>
<path>
<groupId>systems.manifold</groupId>
<artifactId>manifold-ext</artifactId>
<version>${manifold.version}</version>
</path>
<path>
<groupId>systems.manifold</groupId>
<artifactId>manifold-strings</artifactId>
<version>${manifold.version}</version>
</path>
<path>
<groupId>systems.manifold</groupId>
<artifactId>manifold-exceptions</artifactId>
<version>${manifold.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
from manifold-ij.
Related Issues (20)
- IntelliJ freezes on "Gradle: Importing maven repository data" after sync HOT 2
- 'Method is never used ' when using Manifold Properties (Property inference) HOT 1
- Extensions don't seems to handle annotations for parameters correctly HOT 2
- Evaluate values in debug mode doesn't work for extensions, properties,... HOT 2
- [Bug] Sonarlint complains about unused assignment/local variables when using string interpolation HOT 2
- [Feature]Operator Overloading go to declaration
- `when` clause not working with JDK 21 HOT 3
- String interpolation doesn't work with manifold-ij HOT 16
- Java 23 language features HOT 3
- Incompatible with platform 242 HOT 8
- Illegal string escape HOT 8
- Errors using plugin version 2024.1.2 with IJ version 2024.1.x HOT 1
- [bug] 2024.1.2 doesn't work together with Lombok. HOT 3
- AssertionError HOT 5
- Warning when Synchronize on @val property
- Find usages of a property not possible when normal getter/setters are used.
- Abstract property not being marked as used
- Using manifold-sql and the manifold plugin causes IntelliJ to constantly open database connections. HOT 9
- SQL statements that use a table that doesn't exist in the database cause IJ's CPU usage to be high. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from manifold-ij.