On Tue, May 24, 2011 at 9:33 AM, Grzegorz Kossakowski <
grzegorz.kossakow...@gmail.com> wrote:

> 2011/5/24 Eric Ayers <zun...@google.com>:
> > Yes, that class does read bytecode, but the source of the bytecode isn't
> > usually compiled .class files from the classpath, its the result of
> running
> > JDT on the sources.  I think it might be confusing because I worked on a
> > project to try to build type oracle from bytecode from any compiler, but
> we
> > have kind of abandoned that effort in favor of creating an equivalent to
> > javac that spits out more than just bytecode with each compiled class.
>
> Do you want to say that gwtc doesn't read .class files from classpath
> at all? Or if it does in what cases and what for?
>
> > I think I see why you are having the problem, yes.   But since the
> > collections in B are only needed at the source level (Type Oracle does
> not
> > need .class files), your "dev" jar could just contain .class files and a
> >  separate "runtime" jar could just contain .java sources and not .class
> > files.  I think this would fix your build woes, but it might make
> debugging
> > the collections a bit tricky.
>
> The problem is that I don't have .java files for scala-library (it's
> written in scala but compiled to jribble[1]). If I have java class J
> referring to scala class S (that we have .jribble for) then in order
> to run JDT for J we need information about S. The idea was to use
> .class file corresponding to S so JDT can correctly resolve references
> to S from J and build it's AST. Then JDT could build AST nodes for
> Java files that would get converted to GWT nodes and for jribble we
> have our own logic that converts jribble directly to GWT nodes without
> JDT involved in a process. We would need to populate TypeOracle with
> data corresponding jribble classes but we could use the same .class
> files that JDT was using for Scala (jribble) code.
>
> To sum up:
>  * version A of scala-library is needed by gwtc itself and we need
> (and have) only .class files for it
>  * version B of scala-library is in two forms: .jribble files and
> .class files. Class files are needed by JDT in order to resolve
> references to scala-library from Java sources of application we are
> compiling and by special logic that populates TypeOracle for that
> application for .jribble files. We need .jribble files to build GWT
> AST nodes.
>
> Now the question is how can I make version B of .class files visible
> only to JDT and special logic in TypeOracleMediator? Sounds I need
> custom classloader but I fear that gwtc reads .class files somewhere
> else for whatever purpose and I would get some nasty inconsistencies
> that would be extremely hard to debug.
>

If you are in the guts of the compiler and want to populate the type oracle
form byte code, you can build a list of TypeOracleMediator.TypeData objects
from any bytecode you like (doesn't have to be on classpath).  This won't
feed into the building of the AST - that has to build from source.



> If it's not a case how can I plug my own classes that would be visible
> to JDT? Is AbstractCompiler. INameEnvironmentImpl what I should be
> looking at?
>
> [1] jribble contains similar information as java code but jdt doesn't
> know about it, obviously.
>
> --
> Grzegorz Kossakowski
>
> --
> http://groups.google.com/group/Google-Web-Toolkit-Contributors
>



-- 
Eric Z. Ayers
Google Web Toolkit, Atlanta, GA USA

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to