[dna-issues] [JBoss JIRA] Closed: (DNA-172) Java sequencer code has problem with package annotations

Serge Emmanuel Pagop (JIRA) jira-events at lists.jboss.org
Mon Sep 8 11:43:38 EDT 2008


     [ https://jira.jboss.org/jira/browse/DNA-172?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Serge Emmanuel Pagop closed DNA-172.
------------------------------------

    Resolution: Partially Completed


For now we have decided not to sequence the extra package-info.java file for package annotation 

> Java sequencer code has problem with package annotations
> --------------------------------------------------------
>
>                 Key: DNA-172
>                 URL: https://jira.jboss.org/jira/browse/DNA-172
>             Project: DNA
>          Issue Type: Bug
>          Components: Sequencers
>            Reporter: Randall Hauch
>            Assignee: Serge Emmanuel Pagop
>            Priority: Critical
>             Fix For: 0.2
>
>
> The "dna-sequencer-java" project has an "MySource.java" source file in the "src/test/resources/org/acme" that is used in some of the tests.  Because the "src/test/resources" folder is considered a source folder (at least within the Eclipse project), the Eclipse compiler is compiling this class and generating this error:
> 	MySource.java line 22: Package annotations must be in file package-info.java
> Maven is okay, probably because the "src/test/resources" folder is not considered source and is not compiled (although the contents are added to the classpath for tests).  However, if this code is intended to be a valid and well-formed example, then the package annotation should go into a "package-info.java" file.  This is considered a "strongly recommended" best practice by the Java Language Specification (http://java.sun.com/docs/books/jls/third_edition/html/packages.html#7.4.1.1):
>      "The manner in which this restriction is enforced must, of necessity, vary from implementation to implementation. The following scheme is strongly recommended for file-system-based implementations: The sole annotated package declaration, if it exists, is placed in a source file called package-info.java in the directory containing the source files for the package. This file does not contain the source for a class called package-info.java; indeed it would be illegal for it to do so, as package-info is not a legal identifier. Typically package-info.java contains only a package declaration, preceded immediately by the annotations on the package. While the file could technically contain the source code for one or more package-private classes, it would be very bad form.
>      "It is recommended that package-info.java, if it is present, take the place of package.html for javadoc and other similar documentation generation systems. If this file is present, the documentation generation tool should look for the package documentation comment immediately preceding the (possibly annotated) package declaration in package-info.java. In this way, package-info.java becomes the sole repository for package level annotations and documentation. If, in future, it becomes desirable to add any other package-level information, this file should prove a convenient home for this information. "
> However, it is quite possible that this code is intentionally different from the best practice, in which case the test cases should probably also have other examples of source that is not well-formed and invalid.  Consequently, such test source should probably belong in folder that is not considered a source folder by Maven or Eclipse (or any other IDE in use).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the dna-issues mailing list