本文发表在 rolia.net 枫下论坛Sorry , I didn't really get a chance to think it over. The followings are just some ideas off the top of my head.
1.The ideal is somehow to leverage the Java compiler.
2. If 1. is not doable, you may have to implement the compiling rules yourself. This is huge work, but may not that difficult as you thought at first glance because you are not going to analyze the code according to the compiling rules and search for any probable syntax errors. You are creating some specific errors.
3. You program may behave like this:
A user wants to plant a "CanNotResolveSymbol" error into your code. This error is usually about an undefined variable. so the user needs to highlight a variable and then click on item in an error list.Your program searchs where this variable is defined and removes it. This way you get a Java code with the error "Cannot resolve symbol".
This may be the simplest example, not all errors are that straightforward.
You might be having hard time with them.
In the end, I would suggest you doing more research on Internet and see what you can find before you really start work if you have enough time. Because in my solution, you never know how many cases you may have missed.
Good luck!更多精彩文章及讨论,请光临枫下论坛 rolia.net
1.The ideal is somehow to leverage the Java compiler.
2. If 1. is not doable, you may have to implement the compiling rules yourself. This is huge work, but may not that difficult as you thought at first glance because you are not going to analyze the code according to the compiling rules and search for any probable syntax errors. You are creating some specific errors.
3. You program may behave like this:
A user wants to plant a "CanNotResolveSymbol" error into your code. This error is usually about an undefined variable. so the user needs to highlight a variable and then click on item in an error list.Your program searchs where this variable is defined and removes it. This way you get a Java code with the error "Cannot resolve symbol".
This may be the simplest example, not all errors are that straightforward.
You might be having hard time with them.
In the end, I would suggest you doing more research on Internet and see what you can find before you really start work if you have enough time. Because in my solution, you never know how many cases you may have missed.
Good luck!更多精彩文章及讨论,请光临枫下论坛 rolia.net