You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by "Niklaus Giger (JIRA)" <ji...@apache.org> on 2012/05/03 15:12:48 UTC

[jira] [Created] (BUILDR-641) Dependency resolution for java should ignore package-info.java

Niklaus Giger created BUILDR-641:
------------------------------------

             Summary: Dependency resolution for java should ignore package-info.java
                 Key: BUILDR-641
                 URL: https://issues.apache.org/jira/browse/BUILDR-641
             Project: Buildr
          Issue Type: Bug
          Components: Compilers
    Affects Versions: 1.4.6
            Reporter: Niklaus Giger


A project with a project-info.java file consisting only of a line like "package java.lang.applet;" will always get recompiled, as running javac will not create a package-info.class file.
See http://docs.oracle.com/javase/6/docs/technotes/tools/solaris/javadoc.html#sourcefiles


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BUILDR-641) should allow java files without a class definition (e.g package-info.java)

Posted by "Alex Boisvert (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BUILDR-641?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13268370#comment-13268370 ] 

Alex Boisvert commented on BUILDR-641:
--------------------------------------

The challenge here is to find a simple, cheap (computationally) and correct way to determine source files without any class definition.

I was initially thinking about excluding files whose names are not valid Java class identifiers.  This would take care of cases such as package-info.java (since Java class names cannot contain a dash) but it would not cover the general case of files potentially containing package definition and/or comments and no class definition.
                
> should allow java files without a class definition (e.g package-info.java)
> --------------------------------------------------------------------------
>
>                 Key: BUILDR-641
>                 URL: https://issues.apache.org/jira/browse/BUILDR-641
>             Project: Buildr
>          Issue Type: Bug
>          Components: Compilers
>    Affects Versions: 1.4.6
>            Reporter: Niklaus Giger
>
> A project with a project-info.java file consisting only of a line like "package java.lang.applet;" will always get recompiled, as running javac will not create a package-info.class file.
> See http://docs.oracle.com/javase/6/docs/technotes/tools/solaris/javadoc.html#sourcefiles
> Rewording the title to 'should allow java files without a class definition', as there are may be other (pathological) cases where a *.java file consists only of comments.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (BUILDR-641) should allow java files without a class definition (e.g package-info.java)

Posted by "Niklaus Giger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BUILDR-641?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niklaus Giger updated BUILDR-641:
---------------------------------

    Description: 
A project with a project-info.java file consisting only of a line like "package java.lang.applet;" will always get recompiled, as running javac will not create a package-info.class file.
See http://docs.oracle.com/javase/6/docs/technotes/tools/solaris/javadoc.html#sourcefiles

Rewording the title to 'should allow java files without a class definition', as there are may be other (pathological) cases where a *.java file consists only of comments.

  was:
A project with a project-info.java file consisting only of a line like "package java.lang.applet;" will always get recompiled, as running javac will not create a package-info.class file.
See http://docs.oracle.com/javase/6/docs/technotes/tools/solaris/javadoc.html#sourcefiles


        Summary: should allow java files without a class definition (e.g package-info.java)  (was: Dependency resolution for java should ignore package-info.java)



diff --git a/spec/core/compile_spec.rb b/spec/core/compile_spec.rb
index 05a45d4..8caa162 100644
--- a/spec/core/compile_spec.rb
+++ b/spec/core/compile_spec.rb
@@ -179,6 +179,13 @@ describe Buildr::CompileTask, '#sources' do
     sources.each { |src| file(src.pathmap('classes/thepackage/%n.class')).should exist }
   end
 
+  it 'should allow java files without a class definition' do
+    @sources ||= ['package.java'].map { |f| File.join('src/main/java/thepackage', f) }.
+    each { |src| write src, "package thepackage; " }
+    compile_task.from(File.dirname(sources.first)).into('classes').invoke
+    sources.each { |src| file(src.pathmap('classes/thepackage/%n.class')).should exist }
+  end
+
   it 'should allow directories' do
     compile_task.from(File.dirname(sources.first)).into('classes').invoke
     sources.each { |src| file(src.pathmap('classes/thepackage/%n.class')).should exist }
                
> should allow java files without a class definition (e.g package-info.java)
> --------------------------------------------------------------------------
>
>                 Key: BUILDR-641
>                 URL: https://issues.apache.org/jira/browse/BUILDR-641
>             Project: Buildr
>          Issue Type: Bug
>          Components: Compilers
>    Affects Versions: 1.4.6
>            Reporter: Niklaus Giger
>
> A project with a project-info.java file consisting only of a line like "package java.lang.applet;" will always get recompiled, as running javac will not create a package-info.class file.
> See http://docs.oracle.com/javase/6/docs/technotes/tools/solaris/javadoc.html#sourcefiles
> Rewording the title to 'should allow java files without a class definition', as there are may be other (pathological) cases where a *.java file consists only of comments.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (BUILDR-641) should allow java files without a class definition (e.g package-info.java)

Posted by "Peter Donald (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BUILDR-641?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Peter Donald updated BUILDR-641:
--------------------------------

    Fix Version/s: 1.5
    
> should allow java files without a class definition (e.g package-info.java)
> --------------------------------------------------------------------------
>
>                 Key: BUILDR-641
>                 URL: https://issues.apache.org/jira/browse/BUILDR-641
>             Project: Buildr
>          Issue Type: Bug
>          Components: Compilers
>    Affects Versions: 1.4.6
>            Reporter: Niklaus Giger
>             Fix For: 1.5
>
>
> A project with a project-info.java file consisting only of a line like "package java.lang.applet;" will always get recompiled, as running javac will not create a package-info.class file.
> See http://docs.oracle.com/javase/6/docs/technotes/tools/solaris/javadoc.html#sourcefiles
> Rewording the title to 'should allow java files without a class definition', as there are may be other (pathological) cases where a *.java file consists only of comments.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (BUILDR-641) should allow java files without a class definition (e.g package-info.java)

Posted by "Niklaus Giger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BUILDR-641?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13269231#comment-13269231 ] 

Niklaus Giger commented on BUILDR-641:
--------------------------------------

These cases are surely rare. Therefore we should try to find a way to check whether compiling fails because of true errors or these rare cases. May be one could adapt an existing javaparser (e.g. http://code.google.com/p/javaparser/) just to return the main class in the file, while ignoring the rest?
                
> should allow java files without a class definition (e.g package-info.java)
> --------------------------------------------------------------------------
>
>                 Key: BUILDR-641
>                 URL: https://issues.apache.org/jira/browse/BUILDR-641
>             Project: Buildr
>          Issue Type: Bug
>          Components: Compilers
>    Affects Versions: 1.4.6
>            Reporter: Niklaus Giger
>
> A project with a project-info.java file consisting only of a line like "package java.lang.applet;" will always get recompiled, as running javac will not create a package-info.class file.
> See http://docs.oracle.com/javase/6/docs/technotes/tools/solaris/javadoc.html#sourcefiles
> Rewording the title to 'should allow java files without a class definition', as there are may be other (pathological) cases where a *.java file consists only of comments.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira