[
https://issues.apache.org/jira/browse/THRIFT-3301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15660284#comment-15660284
]
ASF GitHub Bot commented on THRIFT-3301:
----------------------------------------
Github user Jens-G commented on a diff in the pull request:
https://github.com/apache/thrift/pull/1120#discussion_r87700206
--- Diff: test/JavaTypes.thrift ---
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+namespace java thrift.test
+
+struct Integer {
+ 1: i32 val
+}
+
+struct String {
+ 1: string val
+}
+
+struct Boolean {
+ 1: bool val
+}
+
+struct Double {
+ 1: double val
+}
+
+struct Long {
+ 1: i64 val
+}
+
+struct Byte {
+ 1: byte val
+}
+
+struct Float {
+ 1: double val
+}
+
+struct List {
+ 1: list<string> vals
+}
+
+struct ArrayList {
+ 1: list<string> vals
+}
+
+struct SortedMap {
+ 1: map<string, string> vals
+}
+
+struct TreeMap {
+ 1: map<string, string> vals
+}
+
+struct HashMap {
+ 1: map<string, String> vals
+}
+
+struct Map {
+ 1: map<double, Double> vals
+}
+
+struct Object {
+ 1: Integer integer,
+ 2: String str,
+ 3: Boolean boolean_field,
+ 4: Double dbl,
+ 5: Byte bite,
+ 6: map<i32, Integer> intmap,
+ 7: Map somemap,
+}
+
--- End diff --
Do we need the same for exception?
> Java generated code uses imports that can lead to class name collisions with
> IDL defined types
> ----------------------------------------------------------------------------------------------
>
> Key: THRIFT-3301
> URL: https://issues.apache.org/jira/browse/THRIFT-3301
> Project: Thrift
> Issue Type: Bug
> Components: Java - Compiler
> Affects Versions: 0.8, 0.9, 0.9.1, 0.9.2
> Environment: Tested on Linux (Ubuntu 14) with Oracle JDK 8
> Reporter: Alexander Volanis
> Assignee: Benjamin Gould
> Attachments: thrift-issue-3301.tgz
>
>
> The Java generator will produce Java classes with the following set of imports
> {code}
> 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;
> {code}
> 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.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)