Skip to content
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

Development tooling: add 'enable hints for javac warnings' to project settings #2644

Closed
bencomp opened this issue Oct 15, 2015 · 2 comments
Closed

Comments

@bencomp
Copy link
Contributor

bencomp commented Oct 15, 2015

In #2574 I argue that the code lacks proper generics, which causes type safety warnings and makes parts of the code hard to understand.

In the Dataverse channel on IRC, @pdurbin says that developers don't see the warnings and my efforts to add generics ( #2422, #2425, #2589, etc.) don't tackle the root problem - that developers don't understand the benefits of Java generics.

Earlier Phil and I looked at possibilities to allow NetBeans configuration with the option to highlight code with raw types and unchecked conversions enabled to be shared in the repository.
Whereas in #775 we discussed that code quality should not depend on a single IDE, in practice it could make sense to nudge the NetBeans users to pay attention by supplying the correct settings automatically.
Simply asking them to change their settings is said to have too little effect.

@pdurbin
Copy link
Member

pdurbin commented Oct 15, 2015

@bencomp after talking to you the other week I opened Netbeans Bug 255606 – Allow per-project settings (i.e. which warnings are enabled) to be shared across teams via source control - https://netbeans.org/bugzilla/show_bug.cgi?id=255606

The nb-configuration.xml file you sent me (below) says, "Properties that influence various parts of the IDE, especially code formatting and the like. You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up." Based on this I tried adding it to the pom.xml like below but it didn't seem to make any difference (but quite possibly I'm doing something wrong):

murphy:dataverse pdurbin$ git diff
diff --git a/pom.xml b/pom.xml
index 380ed0a..569e97a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -12,6 +12,7 @@
     <properties>
         <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <org-netbeans-spi-editor-hints-projects.text.x-java.Javac_5f_RAWTYPES.enabled>true</org-netbeans-spi-editor-hints-projects.text.x-java.Javac_5f_RAWTYPES.enabled>
     </properties>

     <repositories>

Anyway, yes, let's try to get at the root problem. Developers are less likely to use raw types if their IDE such as Netbeans is warning about them.

Maybe we should check in a nb-configuration.xml file? Other projects seem to do this. Right now it's in our .gitignore: https://github.com/IQSS/dataverse/blob/v4.2/.gitignore

Contents of the nb-configuration.xml you sent me:

<?xml version="1.0" encoding="UTF-8"?>
<project-shared-configuration>
    <!--
This file contains additional configuration written by modules in the NetBeans IDE.
The configuration is intended to be shared among all the users of project and
therefore it is assumed to be part of version control checkout.
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
-->
    <spellchecker-wordlist xmlns="http://www.netbeans.org/ns/spellchecker-wordlist/1">
        <word>Dataverse</word>
    </spellchecker-wordlist>
    <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
        <!--
Properties that influence various parts of the IDE, especially code formatting and the like. 
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
That way multiple projects can share the same settings (useful for formatting rules for example).
Any value defined here will override the pom.xml file value but is only applicable to the current project.
-->
        <org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>ide</org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>
        <org-netbeans-modules-projectapi.jsf_2e_language>JSP</org-netbeans-modules-projectapi.jsf_2e_language>
        <org-netbeans-spi-editor-hints-projects.text.x-java.Javac_5f_RAWTYPES.enabled>true</org-netbeans-spi-editor-hints-projects.text.x-java.Javac_5f_RAWTYPES.enabled>
        <org-netbeans-spi-editor-hints-projects.text.x-java.Javac_5f_OVERRIDES.enabled>true</org-netbeans-spi-editor-hints-projects.text.x-java.Javac_5f_OVERRIDES.enabled>
        <org-netbeans-spi-editor-hints-projects.text.x-java.Javac_5f_UNCHECKED.enabled>true</org-netbeans-spi-editor-hints-projects.text.x-java.Javac_5f_UNCHECKED.enabled>
        <org-netbeans-spi-editor-hints-projects.perProjectHintSettingsEnabled>true</org-netbeans-spi-editor-hints-projects.perProjectHintSettingsEnabled>
        <org-netbeans-spi-editor-hints-projects.text.x-java.Javac_5f_DEPRECATED.enabled>true</org-netbeans-spi-editor-hints-projects.text.x-java.Javac_5f_DEPRECATED.enabled>
        <org-netbeans-spi-editor-hints-projects.text.x-java.Javac_5f_UNNECESSARY_5f_CAST.enabled>true</org-netbeans-spi-editor-hints-projects.text.x-java.Javac_5f_UNNECESSARY_5f_CAST.enabled>
        <org-netbeans-spi-editor-hints-projects.text.x-java.Javac_5f_FALLTHROUGH.enabled>true</org-netbeans-spi-editor-hints-projects.text.x-java.Javac_5f_FALLTHROUGH.enabled>
        <org-netbeans-spi-editor-hints-projects.text.x-java.Javac_5f_SERIALIZATION.enabled>true</org-netbeans-spi-editor-hints-projects.text.x-java.Javac_5f_SERIALIZATION.enabled>
        <org-netbeans-spi-editor-hints-projects.text.x-java.Javac_5f_FINALLY.enabled>true</org-netbeans-spi-editor-hints-projects.text.x-java.Javac_5f_FINALLY.enabled>
        <org-netbeans-spi-editor-hints-projects.text.x-java.Javac_5f_EMPTY_5f_STATEMENT_5f_AFTER_5f_IF.enabled>true</org-netbeans-spi-editor-hints-projects.text.x-java.Javac_5f_EMPTY_5f_STATEMENT_5f_AFTER_5f_IF.enabled>
        <org-netbeans-spi-editor-hints-projects.text.x-java.Javac_5f_DIVISION_5f_BY_5f_ZERO.enabled>true</org-netbeans-spi-editor-hints-projects.text.x-java.Javac_5f_DIVISION_5f_BY_5f_ZERO.enabled>
    </properties>
</project-shared-configuration>

@mercecrosas mercecrosas modified the milestone: In Review Nov 30, 2015
@mheppler mheppler added Component: Code Infrastructure formerly "Feature: Code Infrastructure" Component: Documentation labels Jan 28, 2016
@scolapasta scolapasta modified the milestone: Not Assigned to a Release Jan 28, 2016
@pdurbin pdurbin self-assigned this Jun 9, 2017
@pdurbin pdurbin removed Component: Code Infrastructure formerly "Feature: Code Infrastructure" Status: Triaged labels Jun 13, 2017
@pdurbin
Copy link
Member

pdurbin commented Jun 20, 2017

I implemented this in 6535d9d and am closing this issue in favor of #3418.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants