Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-3301

Java generated code uses imports that can lead to class name collisions with IDL defined types

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.8, 0.9, 0.9.1, 0.9.2
    • 0.10.0
    • Java - Compiler
    • None
    • Tested on Linux (Ubuntu 14) with Oracle JDK 8

    Description

      The Java generator will produce Java classes with the following set of imports

      import org.apache.thrift.scheme.IScheme;
      import org.apache.thrift.scheme.SchemeFactory;
      import org.apache.thrift.scheme.StandardScheme;
      
      import org.apache.thrift.scheme.TupleScheme;
      import org.apache.thrift.protocol.TTupleProtocol;
      import java.util.List;
      import java.util.ArrayList;
      import java.util.Map;
      import java.util.HashMap;
      import java.util.EnumMap;
      import java.util.Set;
      import java.util.HashSet;
      import java.util.EnumSet;
      import java.util.Collections;
      import java.util.BitSet;
      import java.nio.ByteBuffer;
      import java.util.Arrays;
      import org.slf4j.Logger;
      import org.slf4j.LoggerFactory;
      

      Any one of the imported classes may cause a name conflict with generated code that happens to define a same name class and uses such class as argument or result to methods.

      The generated code should always use fully qualified references to the classes when necessary and avoid all use of imports.

      Attachments

        1. thrift-issue-3301.tgz
          52 kB
          Alexander Volanis

        Issue Links

          Activity

            People

              bcg Benjamin Gould
              avolanis Alexander Volanis
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: