Moving Axis 1.4 stub project to a Maven based project (Type Access restriction)

For compatibility reasons I have to build Axis 1.4 skeleton classes from exiting an wsdl-file. I use the shipped wsdl2java ant-task from Axis 14. I'm using MyEclipse 8.5 on Java SDK 1.6.0_18, I added the required libraries to my build path and everything goes fine. Now I moved my normal project to a Apache Maven2 project, as I added the dependencies I get following warnings (~500): Des

将Axis 1.4 stub项目移动到基于Maven的项目(类型访问限制)

出于兼容性原因,我必须从退出wsdl文件构建Axis 1.4骨架类。 我使用Axis 14提供的wsdl2java ant任务。 我在Java SDK 1.6.0_18上使用MyEclipse 8.5,将所需的库添加到我的构建路径中,并且一切正常。 现在我将正常的项目移到了Apache Maven2项目中,因为我添加了以下警告(〜500)的依赖关系: 描述资源路径位置类型访问限制:由于所需库的限制,构造函数QName(String,String)不可访问/usr/local/uvst/standard/jdk1.6.

Returning from a finally block in Java

I was surprised recently to find that it's possible to have a return statement in a finally block in Java. It seems like lots of people think it's a bad thing to do as described in 'Don't return in a finally clause'. Scratching a little deeper, I also found 'Java's return doesn't always' which shows some pretty horrible examples of other types of flow contro

从Java中的finally块返回

最近我惊讶地发现,在Java的finally块中可能有return语句。 看起来好像很多人认为按照'不要在最后一个条款中返回'中描述的那样做是件坏事。 深入研究一下,我还发现'Java的回归并不总是这样',它显示了最终块中其他类型流量控制的一些非常可怕的例子。 所以,我的问题是,任何人都可以给我一个例子,在finally块中的return语句(或其他流控制)产生更好/更可读的代码? 你提供的例子是足够的理由,不能从

Java += operator?

This question already has an answer here: Why don't Java's +=, -=, *=, /= compound assignment operators require casting? 11 answers See this post. The result of adding a char to another char is an int, which cannot be added to the String. Whereas with s = s + c1 + c2, the '+' operator associates left to right so the chars are converted to fit string concatenation.

Java + =运算符?

这个问题在这里已经有了答案: 为什么Java的+ =, - =,* =,/ =复合赋值操作符需要转换? 11个答案 看到这篇文章。 将char添加到另一个char的结果是一个int,它不能被添加到String中。 而对于s = s + c1 + c2,'+'运算符从左到右关联,以便将字符转换为适合字符串连接。

Is a += b really equivalent to a = a + b?

This question already has an answer here: Why don't Java's +=, -=, *=, /= compound assignment operators require casting? 11 answers According to Java Language Specification, section 15.26.2, compound assignment operators insert an implicit conversion to the type of the left-hand side operand: The result of the binary operation is converted to the type of the lefthand variable, subj

+ = b是否真的等于a = a + b?

这个问题在这里已经有了答案: 为什么Java的+ =, - =,* =,/ =复合赋值操作符需要转换? 11个答案 根据Java语言规范第15.26.2节,复合赋值运算符向左侧操作数的类型插入一个隐式转换: 二元运算的结果被转换为左变量的类型,并经过值集转换(第5.1.13节)到适当的标准值集(不是扩展指数值集),转换结果是存储到变量中。 赋值a = a + b将要求演员表是等同的: a = (int)(a + b); 你有一个double和int值: a += b

Why b=b+1 when b is a byte won't compile but b+=1 compiles

This question already has an answer here: Why don't Java's +=, -=, *=, /= compound assignment operators require casting? 11 answers This is an interesting question. See JLS 15.26.2. Compound Assignment Operators: A compound assignment expression of the form E1 op= E2 is equivalent to E1 = (T) ((E1) op (E2)) , where T is the type of E1 , except that E1 is evaluated only once. So

为什么b = b + 1当b是一个字节时不会编译,但b + = 1编译

这个问题在这里已经有了答案: 为什么Java的+ =, - =,* =,/ =复合赋值操作符需要转换? 11个答案 这是个有趣的问题。 参见JLS 15.26.2。 复合分配运算符: E1 op= E2形式的复合赋值表达式等价于E1 = (T) ((E1) op (E2)) ,其中T是E1的类型,只是E1只计算一次。 所以当你写b+=1; ,你实际上将结果转换为一个byte ,这与(byte)(b+1)类似,编译器会知道你在说什么。 相反,当你使用b=b+1你添加了两种不同的类型,

>cannot convert from int to char. a+=b

This question already has an answer here: Why don't Java's +=, -=, *=, /= compound assignment operators require casting? 11 answers The answer lies in binary numeric promotion. All operand are promoted to the type of the wider operand, and up to at least int . This is described by the JLS, Section 5.6.2: 2. Widening primitive conversion (§5.1.2) is applied to convert either or bo

>不能从int转换为char。 一个+ = B

这个问题在这里已经有了答案: 为什么Java的+ =, - =,* =,/ =复合赋值操作符需要转换? 11个答案 答案在于二进制数字提升。 所有操作数都被提升为更宽操作数的类型,并且至少达到int 。 这由JLS的第5.6.2节描述: 2.扩展原始转换(§5.1.2)用于转换以下规则中指定的一个或两个操作数: 如果其中一个操作数是double类型,另一个操作数转换为double。 否则,如果任一操作数的类型为float,则另一个操作数转换为fl

Java typecasting confusion

This question already has an answer here: Why don't Java's +=, -=, *=, /= compound assignment operators require casting? 11 answers The first works and the second doesn't because the *= += -= etc add an automatic cast . If, for example, you were to change your second example to; int k=10; double kk = 10.10; k*= kk; It should work. Alternatively you could just add an explicit

Java类型混淆

这个问题在这里已经有了答案: 为什么Java的+ =, - =,* =,/ =复合赋值操作符需要转换? 11个答案 第一个作品和第二个作品并不是因为*= += -=等添加了自动投射 。 例如,如果你要改变你的第二个例子, int k=10; double kk = 10.10; k*= kk; 它应该工作。 或者,你可以添加一个明确的类型转换,如rst = (int)(k*kk); 在对不同数据类型的两个变量应用算术运算时,Java中的算术运算发生。 在这种情况下,编译器会

"+=" operator and int long usage

This question already has an answer here: Why don't Java's +=, -=, *=, /= compound assignment operators require casting? 11 answers When you do += that's a compound statement and Compiler internally casts it. Where as in first case the compiler straight way shouted at you since it is a direct statement :) The line b += Long.MAX_VALUE; Compiler version of it equivalent of b

“+ =”运算符和int长的用法

这个问题在这里已经有了答案: 为什么Java的+ =, - =,* =,/ =复合赋值操作符需要转换? 11个答案 当你做+=这是一个复合语句并且Compiler在内部转换它。 在第一种情况下,由于它是直接声明,所以编译器直接向你大声喊叫:) 该线 b += Long.MAX_VALUE; 它的编译器版本相当于 b += (int)Long.MAX_VALUE; 当然会有长转换为int的有损转换。 http://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.26

Java int += double syntax surprise

This question already has an answer here: Varying behavior for possible loss of precision 2 answers Why does Java perform implicit type conversion from double to integer when using the “plus equals” operator? [duplicate] 2 answers Why don't Java's +=, -=, *=, /= compound assignment operators require casting? 11 answers x += 0.5; is equivalent to: x = (int) (x + 0.5) In general

Java int + =双语法惊喜

这个问题在这里已经有了答案: 变化的行为可能会导致精确度损失2个答案 为什么Java在使用“plus equals”运算符时执行从double到integer的隐式类型转换? [重复] 2个答案 为什么Java的+ =, - =,* =,/ =复合赋值操作符需要转换? 11个答案 x += 0.5; 相当于: x = (int) (x + 0.5) 一般来说: x += y等价于x = (type of x) (x + y) 见15.26.2。 复合分配算子 x += 0.5; 与x = (int) (x + 0.5); 。 这是因为

Adding int to short

This question already has an answer here: Why don't Java's +=, -=, *=, /= compound assignment operators require casting? 11 answers int i = 123456; short x = 12; x += i; is actually int i = 123456; short x = 12; x = (short)(x + i); Whereas x = x + i is simply x = x + i . It does not automatically cast as a short and hence causes the error ( x + i is of type int ). A compound ass

将int加到short

这个问题在这里已经有了答案: 为什么Java的+ =, - =,* =,/ =复合赋值操作符需要转换? 11个答案 int i = 123456; short x = 12; x += i; 实际上是 int i = 123456; short x = 12; x = (short)(x + i); 而x = x + i只是x = x + i 。 它不会自动将其转换为short并因此导致错误( x + i的类型为int )。 E1 op= E2形式的复合赋值表达式等价于E1 = (T)((E1) op (E2)) ,其中T是E1的类型,只是E1只计算一次。 - JLS§