Skip to content

Commit 3533eec

Browse files
committed
Merge pull request #150 from qq254963746/develop
Develop
2 parents 810c588 + 22bf763 commit 3533eec

File tree

4 files changed

+10
-17
lines changed

4 files changed

+10
-17
lines changed

lts-core/src/main/java/com/lts/core/compiler/support/JavassistCompiler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public Class<?> doCompile(String name, String source) throws Throwable {
5050
}
5151
}
5252
}
53-
String[] packages = importPackages.toArray(new String[0]);
53+
String[] packages = importPackages.toArray(new String[importPackages.size()]);
5454
matcher = EXTENDS_PATTERN.matcher(source);
5555
CtClass cls;
5656
if (matcher.find()) {

lts-core/src/main/java/com/lts/core/compiler/support/JdkCompiler.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ public Class<?> doCompile(String name, String sourceCode) throws Throwable {
6363
javaFileManager.putFileForInput(StandardLocation.SOURCE_PATH, packageName,
6464
className + ClassUtils.JAVA_EXTENSION, javaFileObject);
6565
Boolean result = compiler.getTask(null, javaFileManager, diagnosticCollector, options,
66-
null, Arrays.asList(new JavaFileObject[]{javaFileObject})).call();
67-
if (result == null || ! result.booleanValue()) {
66+
null, Collections.singletonList(javaFileObject)).call();
67+
if (result == null || !result) {
6868
throw new IllegalStateException("Compilation failed. class: " + name + ", diagnostics: " + diagnosticCollector);
6969
}
7070
return classLoader.loadClass(name);
@@ -214,13 +214,6 @@ public Iterable<JavaFileObject> list(Location location, String packageName, Set<
214214
throws IOException {
215215
Iterable<JavaFileObject> result = super.list(location, packageName, kinds, recurse);
216216

217-
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
218-
List<URL> urlList = new ArrayList<URL>();
219-
Enumeration<URL> e = contextClassLoader.getResources("com");
220-
while (e.hasMoreElements()) {
221-
urlList.add(e.nextElement());
222-
}
223-
224217
ArrayList<JavaFileObject> files = new ArrayList<JavaFileObject>();
225218

226219
if (location == StandardLocation.CLASS_PATH && kinds.contains(Kind.CLASS)) {

lts-core/src/main/java/com/lts/remoting/codec/DefaultCodec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public RemotingCommand decode(ByteBuffer byteBuffer) throws Exception {
6565
public ByteBuffer encode(RemotingCommand remotingCommand) throws Exception {
6666

6767
RemotingSerializable serializable =
68-
getRemotingSerializable(remotingCommand.getSerializableTypeId());
68+
getRemotingSerializable(remotingCommand.getSid());
6969

7070
// header length size
7171
int length = 4;

lts-core/src/main/java/com/lts/remoting/protocol/RemotingCommand.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class RemotingCommand implements Serializable{
2222
private int opaque;
2323
private int flag = 0;
2424
private String remark;
25-
private int serializableTypeId = -1;
25+
private int sid = -1; // serializableTypeId
2626
/**
2727
* body
2828
*/
@@ -118,12 +118,12 @@ public void setRemark(String remark) {
118118
this.remark = remark;
119119
}
120120

121-
public int getSerializableTypeId() {
122-
return serializableTypeId;
121+
public int getSid() {
122+
return sid;
123123
}
124124

125-
public void setSerializableTypeId(int serializableTypeId) {
126-
this.serializableTypeId = serializableTypeId;
125+
public void setSid(int sid) {
126+
this.sid = sid;
127127
}
128128

129129
@Override
@@ -135,7 +135,7 @@ public String toString() {
135135
", opaque=" + opaque +
136136
", flag=" + flag +
137137
", remark='" + remark + '\'' +
138-
", serializableTypeId='" + serializableTypeId + '\'' +
138+
", sid='" + sid + '\'' +
139139
", body=" + JSONUtils.toJSONString(body) +
140140
'}';
141141
}

0 commit comments

Comments
 (0)