I ran the tests which were generated by the wizzard before i gave you
the pom.
-mbien
On 30.01.22 20:45, Peter Nabbefeld wrote:
Thank You for the links, especially the example code looks really
helpful!
But I still have problems with the POM - the auto-generated testfile
fails to compile.
Kind regards,
Peter
/*
* To change this license header, choose License Headers in Project
Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.nb.hintdemo;
import org.junit.Test;
import org.netbeans.modules.java.hints.test.api.HintTest;
/* TODO to make this test work:
- to ensure that the newest Java language features supported by the
IDE are available,
regardless of which JDK you build the module with:
-- for Ant-based modules, add "requires.nb.javac=true" into
nbproject/project.properties
-- for Maven-based modules, use dependency:copy in validate phase
to create
target/endorsed/org-netbeans-libs-javacapi-*.jar and add to
endorseddirs
in maven-compiler-plugin and maven-surefire-plugin configuration
See: http://wiki.netbeans.org/JavaHintsTestMaven
*/
public class JOptionPaneHintTest {
@Test
public void testWarningProduced() throws Exception {
HintTest.create()
.input("package test;\n"
+ "public class Test {\n"
+ " public static void main(String[] args)
{\n"
+ " assert args[0].equals(\"\");\n"
+ " }\n"
+ "}\n")
.run(JOptionPaneHint.class)
.assertWarnings("3:23-3:29:verifier:" +
Bundle.ERR_JOptionPaneHint());
}
}
Am 30.01.22 um 20:07 schrieb Michael Bien:
On 30.01.22 19:43, Peter Nabbefeld wrote:
Hello Michael,
thank You for Your reply!
(1) I don't know about those .hint files, so especially I don't know
about how much complexity they can handle. Do You have a link,
probably?
the basics are explained here:
https://netbeans.apache.org/jackpot/HintsFileFormat.html
for some examples for hint files, i have a small collection of
general purpose hints here:
https://github.com/mbien/jackpot-inspections
(2) If complexity grows so that I cannot handle it with .hint files,
I'd still prefer to have a fallback solution with Java classes, so
adding the needed POM to the tutorial would still be great.
i think its quicker if i give you a pom which works, you can diff it
yourself to figure out the... differences.
This will be able to build a newly created module with a hint in it
(JDK 8 or 11, please update group id etc).
<?xml version="1.0" encoding="UTF-8"?>
<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>dev.mbien</groupId>
<artifactId>hintmod</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>nbm</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.netbeans.utilities</groupId>
<artifactId>nbm-maven-plugin</artifactId>
<version>4.6</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-api-annotations-common</artifactId>
<version>RELEASE126</version>
</dependency>
<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-modules-java-source-base</artifactId>
<version>RELEASE126</version>
</dependency>
<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-modules-java-source</artifactId>
<version>RELEASE126</version>
</dependency>
<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-spi-java-hints</artifactId>
<version>RELEASE126</version>
</dependency>
<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-spi-editor-hints</artifactId>
<version>RELEASE126</version>
</dependency>
<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-openide-util</artifactId>
<version>RELEASE126</version>
</dependency>
<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-libs-javacapi</artifactId>
<version>RELEASE126</version>
</dependency>
<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-modules-java-hints-test</artifactId>
<version>RELEASE126</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-libs-junit4</artifactId>
<version>RELEASE126</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-modules-nbjunit</artifactId>
<version>RELEASE126</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
-mbien
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists