Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦境迷离
Scala Macro Tools
提交
c478899f
S
Scala Macro Tools
项目概览
梦境迷离
/
Scala Macro Tools
上一次同步 大约 1 年
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Scala Macro Tools
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
c478899f
编写于
11月 25, 2021
作者:
梦境迷离
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ready to 0.3.2
上级
849a7c35
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
31 addition
and
4 deletion
+31
-4
README.md
README.md
+2
-2
README_CN.md
README_CN.md
+2
-2
src/test/scala/io/github/dreamylost/JavaCompatibleTest.scala
src/test/scala/io/github/dreamylost/JavaCompatibleTest.scala
+27
-0
未找到文件。
README.md
浏览文件 @
c478899f
...
@@ -18,8 +18,8 @@ Learn Scala macro and abstract syntax tree.
...
@@ -18,8 +18,8 @@ Learn Scala macro and abstract syntax tree.
# Environment
# Environment
-
It is compiled in Java 8,
11
-
Compile passed in Java 8、
11
-
It is compiled in Scala 2.11.x ~ 2.13.x
-
Compile passed in Scala 2.11.12、2.12.14、2.13.6
# Features
# Features
...
...
README_CN.md
浏览文件 @
c478899f
...
@@ -18,8 +18,8 @@
...
@@ -18,8 +18,8 @@
# 环境
# 环境
-
使用 Java 8,
11 编译通过
-
Java 8、
11 编译通过
-
使用 Scala 2.11.x ~ 2.13.x
编译通过
-
Scala 2.11.12、2.12.14、2.13.6
编译通过
# 功能
# 功能
...
...
src/test/scala/io/github/dreamylost/JavaCompatibleTest.scala
浏览文件 @
c478899f
...
@@ -57,6 +57,13 @@ class JavaCompatibleTest extends AnyFlatSpec with Matchers {
...
@@ -57,6 +57,13 @@ class JavaCompatibleTest extends AnyFlatSpec with Matchers {
| val t = new A()
| val t = new A()
| assert(t.a == 0 && t.g == '?')
| assert(t.a == 0 && t.g == '?')
|"""
.
stripMargin
shouldNot
compile
|"""
.
stripMargin
shouldNot
compile
"""
| @JavaCompatible
| class A(val a: Int, val b: Short)
| val t = new A()
| assert(t.a == 0)
|"""
.
stripMargin
shouldNot
compile
}
}
"JavaCompatible4"
should
"ok"
in
{
"JavaCompatible4"
should
"ok"
in
{
...
@@ -82,4 +89,24 @@ class JavaCompatibleTest extends AnyFlatSpec with Matchers {
...
@@ -82,4 +89,24 @@ class JavaCompatibleTest extends AnyFlatSpec with Matchers {
assert
(
t
.
getA
==
0
)
assert
(
t
.
getA
==
0
)
assert
(
t
.
getB
==
0
)
assert
(
t
.
getB
==
0
)
}
}
"JavaCompatible7"
should
"ok when exists super"
in
{
import
scala.beans.BeanProperty
class
B
(
@BeanProperty
val
name
:
String
,
@BeanProperty
val
id
:
Int
)
@JavaCompatible
case
class
A
(
a
:
Int
,
b
:
Short
,
override
val
name
:
String
,
override
val
id
:
Int
)
extends
B
(
name
,
id
)
val
t
=
new
A
()
assert
(
t
.
getA
==
0
)
assert
(
t
.
getB
==
0
)
}
// Why this code compile failed but test in """ """.stripMargin will pass?
"JavaCompatible8"
should
"fail when exists super but not use @BeanProperty"
in
{
"""
| class B(val name: String, val id: Int)
| @JavaCompatible
| case class A(a: Int, b: Short, override val name: String, override val id: Int) extends B(name, id)
| val t = new A()
|"""
.
stripMargin
should
compile
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录