GithubHelp home page GithubHelp logo

Comments (7)

EotT123 avatar EotT123 commented on July 19, 2024

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.

rsmckinney avatar rsmckinney commented on July 19, 2024

I am not seeing any of this, all of this is implemented.
image
What version of the plugin / IJ / etc. are you using?

from manifold-ij.

EotT123 avatar EotT123 commented on July 19, 2024

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:

screenshot 51

from manifold-ij.

rsmckinney avatar rsmckinney commented on July 19, 2024

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.

EotT123 avatar EotT123 commented on July 19, 2024

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.

screenshot 48

Edit:
For some reason, it's highlighted now and the warning dissapeared.
screenshot 49

However, it's not fixed everywhere. Method parameters still don't get marked as being used:
screenshot 51

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:

screenshot 52

from manifold-ij.

rsmckinney avatar rsmckinney commented on July 19, 2024

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.

superxiao avatar superxiao commented on July 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.