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

error: failed batch processing sources: Should produce more helpful error messages #598

Closed
confile opened this issue Sep 1, 2015 · 19 comments

Comments

@confile
Copy link

confile commented Sep 1, 2015

While translating the following:

 /Applications/J2Objc/j2objc-0.9.8b/j2objc -d /Users/mg/Downloads/Majestella/shared/build/j2objcSrcGen -sourcepath /Users/mg/Downloads/Majestella/shared/src/main/java:/Users/mg/Downloads/Majestella/shared/build/translationExtraction:/Users/mg/Downloads/Majestella/shared/build/source/apt:/Users/mg/Downloads/Majestella/shared/build/source/base:/Users/mg/Downloads/Majestella/shared/src/test/java -classpath /Users/mg/Downloads/Majestella/shared/lib/json-20140107.jar:/Users/mg/Downloads/Majestella/shared/lib/javax.inject-1.jar:/Users/mg/Downloads/Majestella/shared/lib/auto-factory-1.0-beta2.jar:/Users/mg/Downloads/Majestella/shared/lib/auto-service-1.0-rc2.jar:/Users/mg/Downloads/Majestella/shared/lib/javawriter-2.5.1.jar:/Users/mg/Downloads/Majestella/shared-prebuild/build/libs/shared-prebuild-1.0.jar:/Applications/J2Objc/j2objc-0.9.8b/lib/j2objc_annotations.jar:/Applications/J2Objc/j2objc-0.9.8b/lib/j2objc_guava.jar:/Applications/J2Objc/j2objc-0.9.8b/lib/j2objc_junit.jar:/Applications/J2Objc/j2objc-0.9.8b/lib/jre_emul.jar:/Applications/J2Objc/j2objc-0.9.8b/lib/javax.inject-1.jar:/Applications/J2Objc/j2objc-0.9.8b/lib/jsr305-3.0.0.jar:/Applications/J2Objc/j2objc-0.9.8b/lib/mockito-core-1.9.5.jar:/Users/mg/Downloads/Majestella/shared/build/classes --no-package-directories --prefixes prefixes.properties -use-arc --doc-comments --generate-deprecated /Users/mg/Downloads/Majestella/shared/build/source/apt/generated/BPlaceTokenRegistryImpl.java /Users/mg/Downloads/Majestella/shared/build/source/apt/generated/ProxyModule.java /Users/mg/Downloads/Majestella/shared/build/source/apt/majestella/core/app/serviceSelection/ServiceSelectionPresenterMyProxyImpl.java /Users/mg/Downloads/Majestella/shared/src/main/java/TestClass.java

I get the following error:

  Working Dir:
  /Users/mg/Downloads/Majestella/shared
  Cause:
  org.gradle.process.internal.ExecException: Process 'command '/Applications/J2Objc/j2objc-0.9.8b/j2objc'' finished with non-zero exit value 1
  Standard Output:

  Error Output:
  1. ERROR: failed
  2. ERROR: failed
  3. ERROR: failed
  4. ERROR: failed
  5. ERROR: failed
  6. ERROR: failed
  7. ERROR: failed
  8. ERROR: failed
  9. ERROR: failed
  10. ERROR: failed
  11. ERROR: failed
  12. ERROR: failed
  12 problems (12 errors)
  error: failed batch processing sources
@confile
Copy link
Author

confile commented Sep 1, 2015

With version 0.9.7 I did not have this problem.

@kstanger
Copy link
Collaborator

kstanger commented Sep 1, 2015

Could this be an error from Gradle, not J2ObjC?

On Tue, 1 Sep 2015 at 03:51 Michael Gorski notifications@github.com wrote:

With version 0.9.7 I did not have this problem.


Reply to this email directly or view it on GitHub
#598 (comment).

@tomball
Copy link
Collaborator

tomball commented Sep 1, 2015

Why is the command broken up in two lines? I doubt you have a directory
"/App\n lications". Is that a cut&paste issue, or Gradle one building its
sub-command string?

On Tue, Sep 1, 2015 at 6:53 AM Keith Stanger notifications@github.com
wrote:

Could this be an error from Gradle, not J2ObjC?

On Tue, 1 Sep 2015 at 03:51 Michael Gorski notifications@github.com
wrote:

With version 0.9.7 I did not have this problem.


Reply to this email directly or view it on GitHub
#598 (comment).


Reply to this email directly or view it on GitHub
#598 (comment).

@brunobowden
Copy link

@mthvedt - I'm adding you as you authored the annotation error: "failed batch processing sources". What's of note in this case is that the error feedback is very limited as you'll see above. The annotation code may well be legitimately throwing an error but it could be much better feedback.

@confile
Copy link
Author

confile commented Sep 2, 2015

@kstanger @tomball it seems to be a plugin issue so we will track it here: j2objc-contrib/j2objc-gradle#447

@confile confile closed this as completed Sep 2, 2015
@confile confile reopened this Sep 2, 2015
@confile
Copy link
Author

confile commented Sep 2, 2015

After discussion with @brunobowden I decided to reopen.

@confile confile changed the title error: failed batch processing sources error: failed batch processing sources: Should produce more helpful error messages Sep 2, 2015
@brunobowden
Copy link

Currently this appears to be an issue with the plugin. I suggested leaving this open as a request to improve how helpful the error messages were. The current STDERR was very obscure:

  Error Output:
  1. ERROR: failed
  2. ERROR: failed
  3. ERROR: failed
  4. ERROR: failed
  5. ERROR: failed
  6. ERROR: failed
  7. ERROR: failed
  8. ERROR: failed
  9. ERROR: failed
  10. ERROR: failed
  11. ERROR: failed
  12. ERROR: failed
  12 problems (12 errors)
  error: failed batch processing sources

@confile
Copy link
Author

confile commented Sep 2, 2015

If it helps this was introduced in j2objc version 0.9.8 in version 0.9.7 I did not have this problem and error log.

@confile
Copy link
Author

confile commented Sep 8, 2015

@kstanger @tomball This might be related to some Annotation Processor handling in j2objc version 0.9.8.

@tomball
Copy link
Collaborator

tomball commented Sep 8, 2015

Anyone have an example of a failing annotation processor? The original
example can't be used, unless it's part of a public build. The translator
is just relying what the JDT annotation processor is writing to System.err,
so some debugging is necessary.

On Tue, Sep 8, 2015 at 8:59 AM Michael Gorski notifications@github.com
wrote:

@kstanger https://github.com/kstanger @tomball
https://github.com/tomball This might be related to some Annotation
Processor handling in j2objc version 0.9.8.


Reply to this email directly or view it on GitHub
#598 (comment).

@brunobowden
Copy link

@confile - I believe you have a public example you can now point to?

I'm on vacation right now but will look in to this further when I return
Sept 21.

On Tue, Sep 8, 2015, 9:16 AM Tom Ball notifications@github.com wrote:

Anyone have an example of a failing annotation processor? The original
example can't be used, unless it's part of a public build. The translator
is just relying what the JDT annotation processor is writing to System.err,
so some debugging is necessary.

On Tue, Sep 8, 2015 at 8:59 AM Michael Gorski notifications@github.com
wrote:

@kstanger https://github.com/kstanger @tomball
https://github.com/tomball This might be related to some Annotation
Processor handling in j2objc version 0.9.8.


Reply to this email directly or view it on GitHub
#598 (comment).


Reply to this email directly or view it on GitHub
#598 (comment).

@confile
Copy link
Author

confile commented Sep 8, 2015

@tomball

I created a test project here: https://github.com/confile/j2objc-test

To reproduce the error just do:

  1. gradle shared:clean gradle shared:j2objcTranslate
  2. Change something.
  3. gradle shared:j2objcTranslate

Note: If you change variables sometimes recompile works for whatever reason. Then just do some more changes.

@tomball
Copy link
Collaborator

tomball commented Sep 8, 2015

Don't see a problem from the translator. I couldn't build the j2objc-test (too many dependencies), and so hacked the auto/service annotation processor to print messages to System.out and System.err, then throw an AssertionError. This printed out the stdout and stderr text, and for the processing error message, included the location and exception stack trace.

Since Michael is writing an annotation processor and having trouble with it, my guess is that "failed" was an earlier error message from his processor. If that's the case, switching to exceptions during development should provide better diagnostic information, such as shown below:

$ j2objc -classpath ~/jars/guava-18.0.jar:service.jar:common.jar -d . foo/bar/MyProcessor.java 
System.out: hello
System.err: goodbye
----------
1. ERROR in /Users/tball/tmp/foo/bar/MyProcessor.java (at line 0)
    package foo.bar;
    ^
Internal compiler error: java.lang.AssertionError: test failure at com.google.auto.service.processor.AutoServiceProcessor.process(AutoServiceProcessor.java:103)
----------
Exception in thread "main" java.lang.AssertionError: test failure
    at com.google.auto.service.processor.AutoServiceProcessor.process(AutoServiceProcessor.java:103)
    at j2objc.org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.handleProcessor(RoundDispatcher.java:139)
    at j2objc.org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.round(RoundDispatcher.java:121)
    at j2objc.org.eclipse.jdt.internal.compiler.apt.dispatch.BaseAnnotationProcessorManager.processAnnotations(BaseAnnotationProcessorManager.java:159)
    at j2objc.org.eclipse.jdt.internal.compiler.Compiler.processAnnotations(Compiler.java:818)
    at j2objc.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:434)
    at j2objc.org.eclipse.jdt.internal.compiler.batch.Main.performCompilation(Main.java:4129)
    at j2objc.org.eclipse.jdt.internal.compiler.batch.Main.compile(Main.java:1694)
    at com.google.devtools.j2objc.pipeline.AnnotationPreProcessor.process(AnnotationPreProcessor.java:100)
    at com.google.devtools.j2objc.J2ObjC.run(J2ObjC.java:115)
    at com.google.devtools.j2objc.J2ObjC.main(J2ObjC.java:173)

@confile
Copy link
Author

confile commented Sep 9, 2015

@tomball What do you mean by this?

switching to exceptions during development should provide better diagnostic information, such as shown below

As I said before it worked fine with j2objc 0.9.7 also incremental translation worked. But starting with 0.9.8 translation worked but incremental translation gave this strange error.

@confile
Copy link
Author

confile commented Sep 11, 2015

@tomball Why do you close this issue the error is still there?

@confile
Copy link
Author

confile commented Sep 17, 2015

@brunobowden I could modify the j2objc-gradle plugin to throw an error but where should I do that?

@brunobowden
Copy link

I believe this is an error in your annotation processor, your code.

On Thu, Sep 17, 2015, 9:18 AM Michael Gorski notifications@github.com
wrote:

@brunobowden https://github.com/brunobowden I could modify the
j2objc-gradle plugin to throw an error but where should I do that?


Reply to this email directly or view it on GitHub
#598 (comment).

@confile
Copy link
Author

confile commented Sep 17, 2015

@brunobowden How could this be. The processor worked perfect with j2objc 0.9.7. It builds perfect when using the java plugins build task. It also build with j2objc 0.9.8 if you build after clean.

The problem occurs only when doing incremental compile. Changing parts which are not affect the annotation processor should not be affected by the annotation processor.

@confile
Copy link
Author

confile commented Sep 17, 2015

@brunobowden So I guess it is an issue in j2objc 0.9.8

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

No branches or pull requests

4 participants