Skip to content

Commit 5d1594b

Browse files
author
zhourenjian
committed
Support Java 5.0 @j2s* annotations
1 parent d5c5c41 commit 5d1594b

File tree

23 files changed

+336
-110
lines changed

23 files changed

+336
-110
lines changed

sources/net.sf.j2s.ajax/.classpath

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<classpath>
33
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="src" path="annotation"/>
45
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
56
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
67
<classpathentry kind="src" path="ajaxcore"/>

sources/net.sf.j2s.ajax/ajaxcore/net/sf/j2s/ajax/AClass.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
package net.sf.j2s.ajax;
1313

14+
import net.sf.j2s.annotation.J2SIgnore;
15+
1416
/**
1517
* This class is an asynchronous version of Class. It is designed for function
1618
* of Class#forName. While Class#forName will try to load class in synchronous
@@ -27,9 +29,8 @@ public class AClass {
2729
/**
2830
* AClass should NOT be instantialized outside package net.sf.j2s.ajax.
2931
* User should always use its static methods.
30-
*
31-
* @j2sIgnore
3232
*/
33+
@J2SIgnore
3334
protected AClass() {
3435
// prevent from instantialization
3536
}

sources/net.sf.j2s.ajax/ajaxpipe/net/sf/j2s/ajax/SimplePipeHelper.java

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import java.util.Vector;
1717

1818
import net.sf.j2s.ajax.SimpleSerializable;
19+
import net.sf.j2s.annotation.J2SIgnore;
1920

2021
/**
2122
*
@@ -59,12 +60,7 @@ public static void registerPipe(String key, SimplePipeRunnable pipe) {
5960
pipes.put(key, pipe);
6061
}
6162

62-
/**
63-
*
64-
* @param pipe
65-
* @return
66-
* @j2sIgnore
67-
*/
63+
@J2SIgnore
6864
static String registerPipe(SimplePipeRunnable pipe) {
6965
// if (pipe == null) return null; // should never register null pipe!
7066
if (pipes == null) {
@@ -91,9 +87,8 @@ static String registerPipe(SimplePipeRunnable pipe) {
9187
/**
9288
* Generate random pipe key.
9389
* @return
94-
*
95-
* @j2sIgnore
9690
*/
91+
@J2SIgnore
9792
static String nextPipeKey() {
9893
StringBuffer buf = new StringBuffer();
9994
for (int i = 0; i < SimplePipeRequest.PIPE_KEY_LENGTH; i++) {
@@ -146,12 +141,7 @@ public static SimplePipeRunnable getPipe(String key) {
146141
return pipes.get(key);
147142
}
148143

149-
/**
150-
*
151-
* @param key
152-
* @return
153-
* @j2sIgnore
154-
*/
144+
@J2SIgnore
155145
static Vector<SimpleSerializable> getPipeVector(String key) {
156146
if (pipeMap == null) {
157147
return null;
@@ -162,8 +152,8 @@ static Vector<SimpleSerializable> getPipeVector(String key) {
162152
/**
163153
* Tear down the pipe and release its resources.
164154
* @param key
165-
* @j2sIgnore
166155
*/
156+
@J2SIgnore
167157
static void pipeTearDown(String key) {
168158
if (pipeMap == null) return;
169159
Vector<SimpleSerializable> vector = pipeMap.get(key);
@@ -176,13 +166,7 @@ static void pipeTearDown(String key) {
176166
pipeMap.remove(key);
177167
}
178168

179-
/**
180-
* Pipe in datum.
181-
*
182-
* @param key
183-
* @param ss
184-
* @j2sIgnore
185-
*/
169+
@J2SIgnore
186170
static void pipeIn(String key, SimpleSerializable[] ss) {
187171
Vector<SimpleSerializable> vector = getPipeVector(key);
188172
if (vector == null) return; // throw exception?
@@ -195,12 +179,7 @@ static void pipeIn(String key, SimpleSerializable[] ss) {
195179
}
196180
}
197181

198-
/**
199-
*
200-
* @param key
201-
* @return
202-
* @j2sIgnore
203-
*/
182+
@J2SIgnore
204183
static boolean isPipeLive(String key) {
205184
SimplePipeRunnable pipe = getPipe(key);
206185
if (pipe != null) {
@@ -209,12 +188,7 @@ static boolean isPipeLive(String key) {
209188
return false;
210189
}
211190

212-
/**
213-
*
214-
* @param key
215-
* @param live
216-
* @j2sIgnore
217-
*/
191+
@J2SIgnore
218192
static boolean notifyPipeStatus(String key, boolean live) {
219193
SimplePipeRunnable pipe = getPipe(key);
220194
if (pipe != null) {
@@ -228,8 +202,8 @@ static boolean notifyPipeStatus(String key, boolean live) {
228202
* Wait some more seconds to check whether the pipe is to be closed or not.
229203
* @param runnable
230204
* @return whether the pipe is to be closed or not.
231-
* @j2sIgnore
232205
*/
206+
@J2SIgnore
233207
static boolean waitAMomentForClosing(final SimplePipeRunnable runnable) {
234208
if (runnable == null) {
235209
return true;

sources/net.sf.j2s.ajax/ajaxpipe/net/sf/j2s/ajax/SimplePipeRequest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import net.sf.j2s.ajax.SimpleRPCRequest;
1919
import net.sf.j2s.ajax.SimpleSerializable;
2020
import net.sf.j2s.ajax.XHRCallbackAdapter;
21+
import net.sf.j2s.annotation.J2SIgnore;
2122

2223
/**
2324
*
@@ -200,9 +201,8 @@ public void run() {
200201
* Be used in Java mode to keep the pipe live.
201202
*
202203
* @param runnable
203-
*
204-
* @j2sIgnore
205204
*/
205+
@J2SIgnore
206206
static void keepPipeLive(final SimplePipeRunnable runnable) {
207207
new Thread(new Runnable() {
208208

sources/net.sf.j2s.ajax/ajaxpipe/net/sf/j2s/ajax/SimplePipeRunnable.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import net.sf.j2s.ajax.SimpleRPCRunnable;
1616
import net.sf.j2s.ajax.SimpleSerializable;
17+
import net.sf.j2s.annotation.J2SIgnore;
1718

1819
/**
1920
*
@@ -40,20 +41,12 @@ public abstract class SimplePipeRunnable extends SimpleRPCRunnable {
4041

4142
long lastPipeDataReceived;
4243

43-
/**
44-
*
45-
* @param helper
46-
* @j2sIgnore
47-
*/
44+
@J2SIgnore
4845
void setPipeHelper(SimplePipeHelper.IPipeThrough helper) {
4946
this.helper = helper;
5047
}
5148

52-
/**
53-
*
54-
* @param closer
55-
* @j2sIgnore
56-
*/
49+
@J2SIgnore
5750
void setPipeCloser(SimplePipeHelper.IPipeClosing closer) {
5851
this.closer = closer;
5952
}

sources/net.sf.j2s.ajax/ajaxrpc/net/sf/j2s/ajax/SimpleSerializable.java

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
import java.util.Map;
2121
import java.util.Set;
2222

23+
import net.sf.j2s.annotation.J2SIgnore;
24+
import net.sf.j2s.annotation.J2SKeep;
25+
2326
/**
2427
* @author zhou renjian
2528
*
@@ -138,12 +141,7 @@ public String serialize() {
138141
return serialize(null);
139142
}
140143

141-
/**
142-
* @param filter
143-
* @return
144-
*
145-
* @j2sIgnore Only public to Java!
146-
*/
144+
@J2SIgnore
147145
public String serialize(SimpleFilter filter) {
148146
char baseChar = 'B';
149147
StringBuffer buffer = new StringBuffer();
@@ -390,12 +388,7 @@ public String serialize(SimpleFilter filter) {
390388
return buffer.toString();
391389
}
392390

393-
/**
394-
* @param buffer
395-
* @param length
396-
*
397-
* @j2sIgnore
398-
*/
391+
@J2SIgnore
399392
private void serializeLength(StringBuffer buffer, int length) {
400393
char baseChar = 'B';
401394
if (length > 52) {
@@ -441,6 +434,7 @@ private void serializeLength(StringBuffer buffer, int length) {
441434
buffer[buffer.length] = s;
442435
}
443436
*/
437+
@J2SKeep
444438
private void serializeString(StringBuffer buffer, String s) throws UnsupportedEncodingException {
445439
char baseChar = 'B';
446440
if (s != null) {
@@ -636,14 +630,7 @@ public boolean deserialize(final String str) {
636630
return deserialize(str, 0);
637631
}
638632

639-
/**
640-
*
641-
* @param str
642-
* @param start
643-
* @return
644-
*
645-
* @j2sIgnore
646-
*/
633+
@J2SIgnore
647634
public boolean deserialize(final String str, int start) {
648635
char baseChar = 'B';
649636
if (str == null || start < 0) return false;
@@ -924,9 +911,8 @@ public boolean deserialize(final String str, int start) {
924911

925912
/**
926913
* Override Object@clone, so this object can be cloned.
927-
*
928-
* @j2sIgnore
929914
*/
915+
@J2SIgnore
930916
public Object clone() throws CloneNotSupportedException {
931917
Object clone = super.clone();
932918
Set fieldSet = new HashSet();
@@ -1114,9 +1100,8 @@ public static SimpleSerializable parseInstance(String str) {
11141100
* @param str
11151101
* @param start
11161102
* @return
1117-
*
1118-
* @j2sIgnore Already implemented in previous method!
11191103
*/
1104+
@J2SIgnore // Already implemented in previous method!
11201105
public static SimpleSerializable parseInstance(String str, int start) {
11211106
return parseInstance(str, start, null);
11221107
}
@@ -1128,10 +1113,9 @@ public static SimpleSerializable parseInstance(String str, int start) {
11281113
* @param filter SimpleFilter is used to filter out those invalid class name
11291114
* @return SimpleRPCRunnable instance. If request is bad request or
11301115
* specified class name is invalid, null will be returned.
1131-
*
1132-
* @j2sIgnore Only public to Java!
11331116
*/
1134-
public static SimpleSerializable parseInstance(String str, SimpleFilter filter) {
1117+
@J2SIgnore // Only public to Java!
1118+
public static SimpleSerializable parseInstance(String str, SimpleFilter filter) {
11351119
return parseInstance(str, 0, filter);
11361120
}
11371121

@@ -1142,9 +1126,8 @@ public static SimpleSerializable parseInstance(String str, SimpleFilter filter)
11421126
* @param str
11431127
* @param filter
11441128
* @return
1145-
*
1146-
* @j2sIgnore Only public to Java!
11471129
*/
1130+
@J2SIgnore // Only public to Java!
11481131
public static SimpleSerializable parseInstance(String str, int start, SimpleFilter filter) {
11491132
if (str == null || start < 0) return null;
11501133
int length = str.length() - start;

sources/net.sf.j2s.ajax/ajaxswt/net/sf/j2s/ajax/ASWTClass.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
package net.sf.j2s.ajax;
1313

14+
import net.sf.j2s.annotation.J2SIgnore;
15+
1416
import org.eclipse.swt.widgets.Display;
1517
import org.eclipse.swt.widgets.Shell;
1618

@@ -40,9 +42,8 @@ public class ASWTClass extends AClass {
4042
/**
4143
* ASWTClass should NOT be instantialized outside package net.sf.j2s.ajax.
4244
* User should always use its static methods.
43-
*
44-
* @j2sIgnore
4545
*/
46+
@J2SIgnore
4647
protected ASWTClass() {
4748
// prevent from instantialization
4849
}

sources/net.sf.j2s.ajax/ajaxswt/net/sf/j2s/ajax/SimplePipeSWTRequest.java

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import net.sf.j2s.ajax.SimpleRPCRequest;
1818
import net.sf.j2s.ajax.SimpleSerializable;
1919
import net.sf.j2s.ajax.XHRCallbackSWTAdapter;
20+
import net.sf.j2s.annotation.J2SIgnore;
2021

2122
import org.eclipse.swt.widgets.Display;
2223

@@ -84,9 +85,8 @@ public void run() {
8485
* Be used in Java mode to keep the pipe live.
8586
*
8687
* @param runnable
87-
*
88-
* @j2sIgnore
8988
*/
89+
@J2SIgnore
9090
static void swtKeepPipeLive(final SimplePipeRunnable runnable, final Display disp) {
9191
new Thread(new Runnable() {
9292

@@ -161,12 +161,7 @@ public void run() {
161161
}, "Pipe Live Notifier Thread").start();
162162
}
163163

164-
/**
165-
*
166-
* @param runnable
167-
*
168-
* @j2sIgnore
169-
*/
164+
@J2SIgnore
170165
private static void swtPipeRequest(final SimplePipeRunnable runnable) {
171166
String url = runnable.getHttpURL();
172167
String method = runnable.getHttpMethod();
@@ -220,11 +215,7 @@ public void run() {
220215
request.send(serialize);
221216
}
222217

223-
/**
224-
*
225-
* @param runnable
226-
* @j2sIgnore
227-
*/
218+
@J2SIgnore
228219
static void swtPipeQuery(SimplePipeRunnable runnable) {
229220
final HttpRequest pipeRequest = new HttpRequest();
230221
final String pipeKey = runnable.pipeKey;
@@ -259,11 +250,7 @@ public void swtOnLoaded() {
259250
sendRequest(pipeRequest, pipeMethod, pipeURL, pipeRequestData, false);
260251
}
261252

262-
/**
263-
*
264-
* @param runnable
265-
* @j2sIgnore
266-
*/
253+
@J2SIgnore
267254
static void swtPipeContinuum(final SimplePipeRunnable runnable) {
268255
HttpRequest pipeRequest = new HttpRequest() {
269256

@@ -335,13 +322,7 @@ public void swtOnLoaded() { // on case that no destroy event is sent to client
335322
sendRequest(pipeRequest, pipeMethod, pipeURL, pipeRequestData, true);
336323
}
337324

338-
/**
339-
*
340-
* @param string
341-
* @return
342-
*
343-
* @j2sIgnore
344-
*/
325+
@J2SIgnore
345326
static String swtParseReceived(String string) {
346327
SimpleSerializable ss = null;
347328
int start = 0;

0 commit comments

Comments
 (0)