When you use double quotes Groovy turns your string into a GString object and tries to evaluate variables that follow a dollar sign ... change to single quotes and it should work fine ...
GroovyShell shell = new GroovyShell();
String a = 'class ReportFrame$id{}; new ReportFrame$id();'; shell.evaluate(a);