Skip to content
This repository has been archived by the owner on Feb 26, 2023. It is now read-only.

Silence the JavacFiler warning 'compiler.warn.proc.unclosed.type.files' #1084

Merged
merged 1 commit into from Aug 23, 2014
Merged

Conversation

JessThrysoee
Copy link
Contributor

This prevents warnings like:

warning: Unclosed files for the types '[dummy1407426008266]'; these types will not undergo annotation processing

originating from com.sun.tools.javac.processing.JavacFiler.warnIfUnclosedFiles.

It works by opening and closing an OutputStream on the dummy JavaFileObject,
thereby clearing the dummy filename from the JavacFilers internal openTypeNames set.

Note, this will result in a an empty dummy file, e.g. build/generated/source/apt/debug/dummy1407426008266.java

@JessThrysoee
Copy link
Contributor Author

I can't reproduce the failure of the Travis CI build locally. Is this a maven-android-plugin issue?

@WonderCsabo
Copy link
Member

I never experienced this warning before. What is your platform etc.

@JessThrysoee
Copy link
Contributor Author

I use androidannotations in Android Studio-0.82 gradle scripts with help from newest android-apt. On OS X 10.9.4.

This warning can be seen in other androidannotations issues:
https://github.com/excilys/androidannotations/search?q=Unclosed+files+for+the+types&ref=cmdform&type=Issues

and a quick google search turns up quite a few hits:
https://www.google.com/search?q=androidannotations+%22Unclosed+files+for+the+types%22

@JessThrysoee
Copy link
Contributor Author

It was also suggested that an issue should be opened for this: #676 (comment)

@yDelouis
Copy link
Contributor

I confirm the warning using gradle with OSX.

@WonderCsabo
Copy link
Member

I am not sure it is the good idea to pollute the generated class folder with these files. What is the source of the issue, maybe a gradle bug?

@JessThrysoee
Copy link
Contributor Author

I changed the patch so as to avoid creating the dummy file.

Files created via the createResource method are not registered for annotation
processing (as opposed to files created by the createSourceFile method), so we
avoid the JavacFiler warning and we don't have to open/close a stream.

@WonderCsabo
Copy link
Member

Nice, i like this way much better.

I do not know what's the problem with the Travis build. Can you please add -e -X flags to the example project build command in the Travis script in a separate branch so we can see more?

@JessThrysoee
Copy link
Contributor Author

@WonderCsabo
Copy link
Member

I suspect what could be the problem. Travis does not install the build tools SDK component by default anymore. Unfortunetaly i cannot try that out because i am AFK for some time, can you create another PR with exlicitly installing build-tools in the Travis script?

@JessThrysoee
Copy link
Contributor Author

#1090

This prevents warnings like:

   warning: Unclosed files for the types '[dummy1407426008266]'; these types will not undergo annotation processing

Files created via the createResource method are not registered for annotation
processing (as opposed to files created by the createSourceFile method), so we
avoid the JavacFiler warning and we don't have to open/close a stream.
@WonderCsabo
Copy link
Member

I tested this PR, and i found no regressions with command line maven or with Eclipse. @yDelouis can you try with a gradle project so the root issue is indeed resolved?

yDelouis added a commit that referenced this pull request Aug 23, 2014
Silence the JavacFiler warning 'compiler.warn.proc.unclosed.type.files'
@yDelouis yDelouis merged commit c814caa into androidannotations:develop Aug 23, 2014
@yDelouis
Copy link
Contributor

Tested with gradle on mac. The warning disappeared and the compilation works fine.
Thanks a lot !

@WonderCsabo
Copy link
Member

Actually i found out this also happened with maven. At least with maven-compiler-plugin 3.1 with the showWarnings option.

@yDelouis yDelouis added this to the 3.1 milestone Aug 23, 2014
@DayS
Copy link
Contributor

DayS commented Sep 21, 2014

Great job 👍 I was wondering how to resolve this for a while

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

Successfully merging this pull request may close these issues.

None yet

4 participants