You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SecretAPIs.txt 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. FACT: The compiler is a complex beast.
  2. Sometimes its hard to test that widget you've stuck five levels deep down in the
  3. compiler infrastructure, sometimes you want to ship some experimental function
  4. that is only enabled in certain environments.
  5. The solution is that we design the code for testability and configurability.
  6. Q. What does this mean?
  7. It means that throughout the complex are public fields or methods that are
  8. exposed to enable some components to have their behaviour changed, from a
  9. testcase or hosting environment (AJDT). Andy has put a few of these in
  10. over the last few months, and Adrian has just put one in - I don't think
  11. we can get around the need for these things.
  12. Q. How do I identify them?
  13. I keep forgetting where I've put them, so from now on they are all marked
  14. with a task tag of SECRETAPI. When we have a little time to rest and
  15. reflect on what we've been doing we should look at whether they can be
  16. consolidated into an uber-control API module that centralises control of
  17. all these secret buttons and widgets.
  18. Q. Give me an example?
  19. 1. The structure model produced post build is a complex series of data
  20. structures. Incremental compilation is complex too. Incremental
  21. repairs to the structure model to ensure it stays up to date when
  22. incrementally compiling are particularly complex so there is a flag
  23. to turn on incremental repairs.
  24. 2. Testing what happens when processing incremental state is difficult
  25. as there is no nice API to the state object that you can call at the
  26. appropriate point in your test. The StateListener instance that
  27. can be set on the State object enables you to get callbacks when
  28. certain things happen - for example if a change is detected on a
  29. classpath entry the compiler is looking at. Doing it via an optional
  30. listener means we don't have to record endless amounts of
  31. information whilst state processing that would only be consumed
  32. by the test infrastructure.
  33. Q. Can I add them wherever I like?
  34. NO! They are a last resort if you can't test something cleanly
  35. *or* its so experimental you don't want to destabilise existing consumers
  36. of the compiler. For example the state management for incremental
  37. compilation is currently configurable (defaults to off) as it has an
  38. impact on memory usage and probably on other IDEs - when we've resolved
  39. these issues we can look to making ON the default. For any non-test
  40. related secret APIs you should think about when they ought to be made
  41. default !