2

I am currently planning on making a eclipse a plugin and one of the functionality of it would require me to be able to block certain code.

i.e. if person one sets it so that code A is blocked,person two cannot change any of that code and also if person one hides the code person two cannot see the code, but it should still work. So it should still compile even though person two cannot see/change the code person one wrote.

Anyone know if this is possible using a eclipse plugin? If yes, any ideas how? I'm currently learning on how to make plugins so it would be a huge help if someone pointed me the right direction.

Thanks.

Tony
  • 3,425
  • 10
  • 30
  • 46
Ramis
  • 329
  • 1
  • 4
  • 14
  • That sounds like a terrible requirement. Why would anybody want this? – Jim Garrison Nov 26 '13 at 22:43
  • 1
    Basically it used for teaching, So the teacher doesn't want the student to have access important code which could be the answer for something. – Ramis Nov 26 '13 at 22:57

2 Answers2

0

You may have a look into the source code of Mylyn for its Task-Focused UI for the hiding part.

But if there is room for thinking about the requirement itself:

  • check how far you can get with locking mechanisms of SCM tools
  • split projects and introduce dependencies without source
  • be aware that a compiled Java class always can be reverse engineered to a certain degree

[Update]

Option 1:

For your use case, I think you should keep it simple:

  • Use an obfuscator
  • only provide binaries (jar or class files) + JavaDoc

Option 2:

  • you can try to introduce a pre-compile step / custom builder to decrypt your source (Right click on project: Properties > Builders)

[Note] This reminds me back to the time of my own studies. There was a task to implement an AI that finds the way through an initially unknown maze. Of course, there was a short cut: instant exploring via Java Reflections. Hiding something from your students, can make them curious about the wrong thing leading away from the original task. But it may be a way to find the talented. :-)

Jens Piegsa
  • 7,399
  • 5
  • 58
  • 106
  • I was thinking of just providing the binaries, but it would mean it is different for each different language. It would be much better if there was a way which code be used for any language. – Ramis Nov 26 '13 at 23:08
  • Another idea that I had was that the user selects lets says lines 2-5 to show while the rest of the file is hidden. I could extract those 3 lines and then encrypt the actual file. When compiling I could just insert the 3 lines which they could have modified and insert them into the file. I'm just not sure if a plugin can do all that? – Ramis Nov 26 '13 at 23:10
  • So then you want to decrypt source code before compiling it. Well, this targets the build tool chain. And this is still language-dependent. – Jens Piegsa Nov 26 '13 at 23:23
  • 1
    Why is language-dependent? In my head it's basically the same as clicking the build button but before you do that it decrypts the source code and adds in the modified part. I was thinking of just making a new button which would do that and then it would just run whatever the build button does. Or is this not possible? – Ramis Nov 26 '13 at 23:31
  • I had another idea. Would it be possible to get eclipse to read a file which is a binary (or some encrypted type) and display it? which could then be saved back into the encrypted format? e.g. encrypted java file when read by eclipse, it is first encrypted and then shown. then when saving it is encrypted. – Ramis Dec 03 '13 at 00:21
0

Can you put the code you want to protect in a library and deploy it to the other team as a binary jar file? This is far from perfect given how good java decompilers are, but maybe it will suffice?

Is this a matter of trust or security? If it's a matter of not trusting certain team members with code, could you not enforce something on your code repository instead. For example in our SVN repo we are not allowed to commit code without a corresponding ticket #.

k2col
  • 2,167
  • 18
  • 18