This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Which library implementation to use/work on?


Thanks, I got it to work eventually. That switch disables building of
ecj so I had to first compile without it, then install, then adjust my
path, then reconfigure/make/make install - bit confusing.

I then encountered a couple of other issues. Firstly it seems there's
something odd about the Google protocol buffers library that gcj does
not like:

com/google/protobuf/SingleFieldBuilder.java: In method
'com.google.protobuf.SingleFieldBuilder.mergeFrom(com.google.protobuf.GeneratedMessage)':
com/google/protobuf/SingleFieldBuilder.java:192:0: error: class
'com.google.protobuf.GeneratedMessage' has no method named
'getDefaultInstanceForType' matching signature
'()Lcom/google/protobuf/Message;'

The code is some morass of generics so it's hard for me to figure out
what the issue is here. The relevant code is:

public class SingleFieldBuilder
    <MType extends GeneratedMessage,
     BType extends GeneratedMessage.Builder,
     IType extends MessageOrBuilder>
    implements GeneratedMessage.BuilderParent {

  ....
  private MType message;

  public SingleFieldBuilder<MType, BType, IType> mergeFrom(
      MType value) {
    if (builder == null && message == message.getDefaultInstanceForType()) {
      message = value;
    } else {
      getBuilder().mergeFrom(value);
    }
    onChanged();
    return this;
  }
}

Sure enough the GeneratedMessage class doesn't have
getDefaultInstanceForType - it's implemented by subclasses.

GeneratedMessage says this at the top:


/**
 * All generated protocol message classes extend this class.  This class
 * implements most of the Message and Builder interfaces using Java reflection.
 * Users can ignore this class and pretend that generated messages implement
 * the Message interface directly.
 *
 * @author kenton@google.com Kenton Varda
 */

I suspect the reference to "implementing most of the interfaces using
reflection" is key. I don't know what that means exactly, the class is
very large and complicated:

http://code.google.com/p/protobuf/source/browse/trunk/java/src/main/java/com/google/protobuf/GeneratedMessage.java

I switched to the "lite" runtime which is simpler and the issue went away.

The next problem is more stubs in classpath: specifically the elliptic
curve related classes in java.security.spec. I'm already using
BouncyCastle to implement the EC crypto - these classes are literally
just data structures. They're probably quite trivial to do.

I'll try copying the equivalent code from openjdk and see if that works.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]