Don't suppose this has anything to do with using internal Sun interfaces which 
are no longer preferred in newer Java versions?


https://stackoverflow.com/questions/46773519/accessing-com-sun-tools-javac-util-from-java-9



Get Outlook for iOS<https://aka.ms/o0ukef>
________________________________
From: Peter Nabbefeld <[email protected]>
Sent: Saturday, February 5, 2022 10:14:00 AM
To: [email protected] <[email protected]>
Subject: Re: Adding Java hints


I still cannot build the example hint using maven.

Error:
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.my.custom.hints.JOptionPaneHintTest
Feb 05, 2022 5:06:15 PM org.netbeans.modules.masterfs.watcher.Watcher
getNotifierForPlatform
INFORMATION: Native file watcher is disabled
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed:
0.411 s <<< FAILURE! - in org.my.custom.hints.JOptionPaneHintTest
[ERROR] testWarningProduced(org.my.custom.hints.JOptionPaneHintTest)
Time elapsed: 0.346 s  <<< ERROR!
java.lang.NoClassDefFoundError: com/sun/tools/javac/util/Abort
     at
org.my.custom.hints.JOptionPaneHintTest.testWarningProduced(JOptionPaneHintTest.java:23)
Caused by: java.lang.ClassNotFoundException: com.sun.tools.javac.util.Abort
     at
org.my.custom.hints.JOptionPaneHintTest.testWarningProduced(JOptionPaneHintTest.java:23)


Trying to resolve the error by adding nb-javac dependencies results in:

[ERROR] Failures:
[ERROR]   JOptionPaneHintTest.testWarningProduced:30 found JavaSource
for
/tmp/tests-peter/org.my.custom.hints.JOptionPaneHintTest/testWarningProduced/src/test/Test.java@3f9f1b68:bd8db5a


The error is logged in the generated test method.

However, the only available nb-javac-* modules available in maven
central repository are versioned RELEASE82, so they're probably wrong.


Probably someone has a working implementation of a Java Hint (as shown
in the tutorial at
https://netbeans.apache.org/tutorials/nbm-java-hint.html) based on Maven
or knows about some at Github?

Kind regards,
Peter



Am 30.01.22 um 21:22 schrieb Peter Nabbefeld:
>
> Hm, strange, I'll try again next week-end, then. Thank You for helping!
>
> Kind regards,
> Peter
>
>
> Am 30.01.22 um 21:14 schrieb Michael Bien:
>> 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
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> 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



Reply via email to