java-5

How do I add javax.annotation.Generated to Java SE 5?

南楼画角 提交于 2019-12-01 02:48:11
问题 I'm working on a project that has to run on Java SE 5 and Java SE 6. I recently started using a tool that adds @Generated annotations to generated code, and I want to keep those annotations. It looks like javax.annotation.Generated is in Java 5 EE and Java 6 SE and later, but is not in the Java 5 SE API. What's the best way to include javax.annotation.Generated when I send it to the customer, so it will run on both Java SE 5 and Java SE 6 without any problems? Do I just need to include an

How to troubleshoot Out Of Memory error on Production system

送分小仙女□ 提交于 2019-11-30 16:59:28
We are using JBoss_4_0_4_GA with JDK 1.5.0 (no updates) on a Windows The JBoss server is run within a Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org . Since the JVM is so old I cannot even use the -XX:+HeapDumpOnOutOfMemoryError option on the JVM. What are my option to find out the issue? As usual the Out of Memory exception is happening on different parts of the application. I do not have the liberty to upgrade the JVM right away. The current VM settings Java Additional Parameters wrapper.java.additional.1=-Xms512m wrapper.java.additional.2=-Xmx1024m wrapper.java.additional.3=-Dsun

Will compiling for Java 1.5 on Java 1.7 still work?

偶尔善良 提交于 2019-11-30 11:42:54
I've recently moved to Java 7 in one of my projects. I claim that it can run on Java 1.5 simply because there's nothing I depend on that is in Java 6 or 7. However when compiling today I noticed this: bootstrap class path not set in conjunction with -source 1.5 Google has found little information on this warning. Does this mean that you can't compile to Java 1.5 from Java 1.7? This Oracle blog explains the warning: http://blogs.oracle.com/darcy/entry/bootclasspath_older_source The reason is, that if you fail to set rt.jar for the older platform, then: If the second step is not taken, javac

Reasons and advantages for upgrading to Java 6 for a non-technical decider (at the client)

末鹿安然 提交于 2019-11-30 07:19:36
问题 I'd like to upgrade from Java 5 to Java 6. We all know about the technical advantages and benefits, but: I have the problem that a major client refuses to upgrade from java 5 to java 6 because of "the risks" and "no/too few benefits for us" (banking sector). What can be answered to a non-technical decider at the client what benefits he'll get from an upgrade - or otherwise which problems/consequences may arise if he'll stay with java 5? It's not a "fire and forget"-product, it's activly

Temporarily disable or prevent repainting JViewPort on scrolling with a mouseDrag

与世无争的帅哥 提交于 2019-11-29 12:21:31
I have written a MouseListener as defined below so that I can move a JButton around to reorder the components that are within the JPanel . The JPanel is within a JScrollPane so that when multiple components are added they can be scrolled. The problem I have is that when dragging the component and the mouse goes out of the scrollpane/viewport then the component will snap back to its position within the JPanel then will be drawn in the correct location. I assume that this behavior is due to the Viewport calling a repaint of its children when I call scrollRectToVisible() Is there a way that I can

Mockito isA(Class<T> clazz) How to resolve type safety?

北战南征 提交于 2019-11-28 22:42:30
in my test I have the following line: when(client.runTask(anyString(), anyString(), isA(Iterable.class)).thenReturn(...) isA(Iterable.class) produces warning that it needs unchecked conversion to conform to Iterable<Integer> . What is syntax for that? isA(Iterable<Integer>.class) isA((Iterable<Integer>)Iterable.class do not work. Any suggestions? Mockito/Hamcrest and generic classes Yes, this is a general problem with Mockito/Hamcrest. Generally using isA() with generic classes produces a warning. There are predifined Mockito matchers for the most common generic classes: anyList() , anyMap() ,

How to disable TestNG test based on a condition

我是研究僧i 提交于 2019-11-28 19:19:25
Is there currently a way to disable TestNG test based on a condition I know you can currently disable test as so in TestNG: @Test(enabled=false, group={"blah"}) public void testCurrency(){ ... } I will like to disable the same test based on a condition but dont know how. something Like this: @Test(enabled={isUk() ? false : true), group={"blah"}) public void testCurrency(){ ... } Anyone has a clue on whether this is possible or not. You have two options: Implement an annotation transformer . Use BeanShell . Your annotation transformer would test the condition and then override the @Test

When should I use the java 5 method cast of Class?

梦想的初衷 提交于 2019-11-28 12:02:26
Looking through some code I came across the following code trTuDocPackTypdBd.update(TrTuDocPackTypeDto.class.cast(packDto)); and I'd like to know if casting this way has any advantages over trTuDocPackTypdBd.update((TrTuDocPackTypeDto)packDto); I've asked the developer responsible and he said he used it because it was new (which doesn't seem like a particularly good reason to me), but I'm intrigued when I would want to use the method. These statements are not identical. The cast method is a normal method invocation ( invokevirtual JVM instruction) while the other is a language construct (

Temporarily disable or prevent repainting JViewPort on scrolling with a mouseDrag

我的梦境 提交于 2019-11-28 05:52:58
问题 I have written a MouseListener as defined below so that I can move a JButton around to reorder the components that are within the JPanel . The JPanel is within a JScrollPane so that when multiple components are added they can be scrolled. The problem I have is that when dragging the component and the mouse goes out of the scrollpane/viewport then the component will snap back to its position within the JPanel then will be drawn in the correct location. I assume that this behavior is due to the

Is is possible to build java code using JDK 1.6 to run on JRE 1.5?

假如想象 提交于 2019-11-28 04:06:03
问题 Is there an option to build java code to run on JRE 1.5 when compiled using JDK 1.6? PS: I am new to Java. 回答1: If you compile your code with 1.6 then it will not run on 1.5. If you want it to run in 1.5 then you can compile the code with 1.5 and it would be able to run on both. Try compiling with 1.5 and if there are errors then post them. The only way it will not compile on 1.5 is if you use specific 1.6 enhancements in your code. To answer the real question. javac -target 1.5 See here for