学习JAVA泛型发现Rich Edit的问题,请帮忙看一下
|
tenn
2007-11-23
例如如下代码,Rich Edit编辑模式下,选择代码,选择java,得到如下:
java 代码 public class GenericsFoo<T> { private T x; public GenericsFoo(T x) { this.x = x; } public T getX() { return x; } public void setX(T x) { this.x = x; } } public class GenericsFooDemo { public static void main(String args[]){ GenericsFoo<String> strFoo=new GenericsFoo<String>("Hello Generics!"); GenericsFoo<Double> douFoo=new GenericsFoo<Double>(new Double("33")); GenericsFoo<Object> objFoo=new GenericsFoo<Object>(new Object()); System.out.println("strFoo.getX="+strFoo.getX()); System.out.println("douFoo.getX="+douFoo.getX()); System.out.println("objFoo.getX="+objFoo.getX()); } } 提交后变为: java 代码 public class GenericsFoo { private T x; public GenericsFoo(T x) { this.x = x; } public T getX() { return x; } public void setX(T x) { this.x = x; } } public class GenericsFooDemo { public static void main(String args[]){ GenericsFoo strFoo=new GenericsFoo("Hello Generics!"); GenericsFoo douFoo=new GenericsFoo(new Double("33")); GenericsFoo objFoo=new GenericsFoo(new Object()); System.out.println("strFoo.getX="+strFoo.getX()); System.out.println("douFoo.getX="+douFoo.getX()); System.out.println("objFoo.getX="+objFoo.getX()); } } 注意到了吗?与<>相关的元素都没有了(只有在xml下可以),这个是不是应该尽快改进呢,JAVA1.5出现已经有年头啦。 |
|
|
tenn
2007-11-23
我知道使用BBCode可以解决这个问题,但是Rich Edit为什么对<>就那么敏感直接过滤掉呢?
|

