NetBeansNewfeaturesandimprovementsinthenextreleaseofNetBeansmakeitabetterIDEforanykindofdeveloper.
Fromeditingtobrowsing,versioning,building,debugging,profilingorvisualdesign,therearegreatnewsforeverybody.
NewCoreFeaturesinDepthOsvaldoDoederlein6.
0IssueThreeNNetBeans6.
0:NewCoreFeaturesinDepthIt'sthattimeagain.
Amajor,dot-zeroreleaseofNetBeanswillbeavailablesoon–aboutayearandahalfafter5.
0,whichintroducedsignificantnewfeaturesliketheMatisseGUIbuilder,andextensiveimprovementsinCVSintegration,webservicesandmoduledevelopment,tocitebutafew.
Incontrast,version5.
5focusedoutsidethecoreIDEbysupportingseveralnewPacksthatincreasedNetBeans'over-allfunctionalitytoalevelstillunmatchedbyanyotheropen-sourceIDE.
Now,isNetBeans6.
0worthyofthebumpinthemajorversionnumberYoubetitis,andinthisarticlewe'lllookatsomeofthemostimportantandinterestingnewfeaturesinthecoreIDE.
Javac-poweredLet'sbeginbylookingnotatanend-userfeaturebutatacoreIDEtechnologythatprovidesthefoundationformanyenhance-ments.
PastreleasesofNetBeans,likemanyotherprogrammingtools,containedcustomcodetoparseJavasourcesandassistincodeunderstandingandmanipula-tiontasks(likerefactorings,hintsandfixes,outlining,etc).
Theresultwassometimeslimitedfunctionality:simplehighlighting,non-bulletproofrefactorings,andthelackofsupportforfeatureslikecodecomple-tioneverywhereJavacodeappears.
TheobvioussolutionwouldbereusingthematuretechnologyofthejavaccompilertodoallJavasourceprocessing.
ButjavacwasnotdesignedtosupporttherequirementsofamodernIDE:itwaswrittenandtunedforbatchexecution,andtoacceptasinputfullcompilationunits,performacompletecom-pilationandproduce.
classfilesasoutput.
IDEshaveverydifferentrequirements,amongwhichthemostcriti-calisworkinginmemoryonly.
Supposethataftereachcharacteryoutype,theIDEwantstoanalyzetheentireclassagainsoitcanupdatesyntaxerrorindications,performhighlighting,andprovideotherfeaturesthatdependonthecodestructure.
Oneoptionwouldbetowritetheeditor'scurrentcontenttoatemporaryfile,invokejavacandparsetheresulting.
classfiles.
Butthiswouldbeveryinefficient.
Amuchbettersolutionistocalljavacinthesameprocess(asalocallibrary),thenpassthecurrentsourcesasanin-memoryparam-eterandreceiveinreturnthedatastructurescontainingthesameinformationthatwouldbepresentintheclassfiles(whichwouldn'tneedtobecreated).
UptoJavaSE5,thissolutionwouldbepos-sible,butonlyusingtheproprietary–andoftenunstable–internalAPIsofaJavacompiler.
ThissituationchangedwithJavaSE6,whichintroducedJSR199(JavaCompilerAPI)andJSR269(PluggableAnnotationProcess-ingAPI).
TheJavaCompilerAPIenablestightandefficientintegra-tionwithjavac(andotherJavasourcecompilers),andJSR269–althoughinitiallydesignedforannotationprocessing–providesasource-levelequivalentofreflectionmetadata.
Workingtogether,thesenewAPIsallowIDEsandothertoolstodigdeeplyintothestructuralinformationthatjavacextractsfromsourcecode.
Addi-tionally,javac'simplementationwasenhancedandtunedforembed-dedandinteractiveuse.
NetBeanswasheavilyupdatedtointegratewiththesenewcapa-bilities,enablingmanyimprovementsintheIDE(discussedbelow).
Thechangesalsopromisefuturebenefits:whenJavaSE7comesoutwithanewsetoflanguageenhancements,youshouldexpectNetBeans'toolsettocatchupveryfast.
AneweditorCommonsensesaysnoproductcanbeperfectineverythingitdoes,butNetBeansisgettingclosereachday.
Historically,Net-BeansusershavebeenproudoftheIDE'scompletecoverageofJavaplatformsfromMEtoEE,itssupportforeffectiveGUIbuilding,anditsintuitiveUIandopenarchitecture.
Ontheotherhand,theIDElaggedincertainareas,likeinthecodeeditororrefactoring.
Thiscouldputoffprogrammersveryfocusedinsourcecode…typeswho'llpickemacsovervisualdesignersanyday.
Well,theseprob-lemsarenomorewithNetBeans6.
0.
IssueThreeNjackpot.
netbeans.
orgTheJackpotproject.
www.
netbeans.
info/downloads/dev.
phpNetBeans6.
0developmentbuilds.
CoreIDENNetBeansMagazineAST-basedselectionSelectingwordsorlinesisgoodenoughfortexteditors,butwhenworkingwithsourcesyouoftenneedtoworkwithrangesoftextthatformcoherentpiecesofcode.
Sayyouwanttocopyallthecodeinsideaforloopbody1inordertopasteitinanotherloopwithsimilarlogic.
Justplacethecursorinanyblankpositioninsidetheloopbody,pressAlt+Shift+Upandyou'redone.
Theeditorselectstheinnermostrangeoftextthatincludesthecursorposition,anddelimitsanodeofthesource'sAbstractSyntaxTree.
TheJavacompiler(asdomostcompilers)parsessourcecodeintoanintermediaryrepresentation,whichisstructuredasatree.
Eachnodeinthisdatastructure(calledanAbstractSyntaxTree)representsacodeelement:aclass,method,statement,block,identifier,operator,literal,etc.
ThoughcodeprocessingtoolsusuallymanipulateprogramsasASTs,manyuseasimpleparserthatproducesonlyabasictree.
The"full"ASTproducedbyacompletecompilerlikejavac,whichiscapableofsemanticanalysisandcodegeneration,willcontainverydetailedandreliableinformationabouteachnode.
Forexample,thenodeforanidentifierholdsnotonlyitsnamebutalsoitstypeandits"definiteassignment"status(whethertheidentifierisguaranteedtobeinitializedatagivenpoint);itcanevenholditsstatically-calculatedvalue(whenapplicable).
ToolsthatworkontopofafullASTaremuchmorepowerfulandreliable.
Thedifferencewon'tbenoticeableforasimpleselectionfeature,butitmaybeverysignificantformoresophisticatedfunctionalitylikerefactorings.
EPressingAlt+Shift+Upagainexpandstheselectiontothenextouternode,inthiscasethecompleteforstatement;thenanewkey-strokemayselecttheentiremethod,andsoforth.
Alt+Shift+Downwillretracttheselectiontoaninnernode.
Figure1showsthisfeaturebeingusedtoselectamulti-linestatementeasilyandprecisely.
Ibetyouwillquicklybehookedonthisfeatureandforgetaboutalltheotherselectionshortcuts!
There'snothinglikeacodeeditorthatgrokscode,nottext.
SemantichighlighterTheeditor'ssyntaxhighlighterwaspro-motedtoasemantics-awarehighlighter.
Itcanapplystylesbasednotonlyonthetypesoftokens(likeidentifiers,operatorsorcomments),butalsobasedondifferentmeaningsthatakintokensmayhave–forinstance,anidentifiermaybeaclassnameoralocalvariablename,aparameter,aconstantfield,etc.
1Dependingonyourbracingstyle,thismaynotbeaseasyasselectingafewfulllines.
Therearemanyotherexamples,likeselectingacomplexexpressionthatspansmultiplelines.
Figure1Severalneweditorfeaturesinaction.
ASemantichighlighting(e.
g.
,identifyingusagesofgetImage(),andstaticvariablesinitalics)Keywordcompletionatamethod'sparameterlist.
Hierarchyview(openedonPaintCanvas)AST-basedselectionIssueThreeNNetBeans6.
0:NewCoreFeaturesinDepthOnebenefitofsemantichighlightingisthatithelpsyoutakeextracarewhenas-signingtostaticfields(sincemanythread-safetyandmemory-leakbugsinvolvestat-ics).
Figure1showsthisoff;noticethatstaticfields(andreferencestothese)ap-pearinitalics.
Thereareotherpowerfulusesforthenewhighlightingengine:Identifyingusages–Selectanyidenti-fier,andtheeditorhighlightsallitsusesinthesamecompilationunit.
Again,Figure1exemplifiesthis:clickingonamethodname,allinvocationstoitarehigh-lighted.
Flagging"Smellycode"–Theneweditorhighlightsunusedvariablesandimports,aswellasusageofdeprecatedclassesandmethods.
Youdon'tneedtoperformabuildorrunacodelinttooltodetectthesesim-ple(butfrequent)problemsanymore.
Exitandthrowpoints–Selectingamethod'sreturntypewillhighlightallreturnstatements.
Selectinganexceptioninthemethod'sthrowslistwillflagallthrow'softhatexceptiontype.
Allinvocationstoothermethodsthatmaythrowthesameexcep-tionarealsoflagged.
BettercodecompletionThebewilderingamountofAPIsyouhavetousethesedaysmakescodecompletiononeofthemostcriticalfeaturesofanymoderncodeeditor.
NetBeans6.
0haslearnedmanynewtrickshere:Keywordcompletion–Ifyou'vejusttypedapackagedeclarationinanewsourcefile(forexample),Alt+Spacewillbringonlythekeywordsthatarelegalinthatposition:abstract,class,enum,final,import,inter-faceandpublic.
Figure1showsanotherexample:aftertheopeningparenthesisofamethoddeclaration,thepreferredcompletionsareallprimitivetypes.
Type-basedvariablenames–Completingat"ConfigurationFile_",theeditorwillofferthevariablenamescf,configurationFileandfile.
(I'musing"_"torepresentthecursorposition.
)Generics-awarecompletions–Whenassigningavariablewithagenerictypetoanewexpression,theeditorwillofferallcompatibletypes,includinggenericarguments.
Forexample,at"Mapm=new_",codecompletionlistsallimplementationsofMap,eachwiththesameparameters.
Annotation-awarecompletions–Whencompletingafter"@",you'llbeofferedalltheannotationsthatcanbeusedinthegivenscope.
Andiftheselectedannotationrequiresparameterstheeditorwillprovidecompletionsforthesetoo.
Passingparameters–At"x=m(_",thetopcompletionswillbevaluesinscopethatarecompatiblewithm()'sfirstparameter.
Ifthemethod'sparameternamesareavailableandtherearevariableswithsimilarnamesinscope,thisisusedtosortthecompletionsfurther.
You'llalsobeofferedfullcompletionswiththeparameterlistfilledwiththosevariables.
Commonconstructors–Whenyouinvokecodecompletionwiththecursorpositionedbetweenclassmembers,you'llbeofferedtocreateaconstructorwithoutargumentsandonethatreceivesinitialvaluesforallfields(iftheseconstructorsdon'talreadyexist).
Catchingexceptions–Completionat"catch(_"willonlyofferex-ceptionsthatarethrowninthecorrespondingtryblock,buthaven'tbeenhandledyetbypreviouscatchblocks.
NewbrowsingviewsTheeditorintroducesseveralnewviewsforsourcecodebrowsing.
TheMembersviewshowsthemembersofaJavatypetogetherwiththeirjavadocs,makingiteasytofindaparticularmethod,fieldorinnerclass.
TheHierarchyviewshowstheinheritancetreeofaJavatype.
Figure1demonstratesthisview;noticethefilterbuttonsthatletyoutogglebetweensupertypesorsubtypesandbetweensimpleandfullyqualifiedclassnames.
Youcanalsochoosewhetherornottoshowinnerclassesandinterfaces.
TheDeclarationviewsummarizesthedeclarationoftheselectedJavaelement(type,methodorfield).
Despiteitsname,thisviewalsoshowstheinspectedelement'ssourcecodeifit'savailable.
TheDeclarationViewisespeciallyusefulwheninvokingcodestillunderCoreIDENNetBeansMagazine2Adevelopment,notyetdocumentedwithjavadoc.
Finally,theJavadocviewshowsthejavadocsfortheselectedJavaelement.
EditableDiffandInlineDiffTheeditor'simprovedarchitecturemakesiteasierforvariousfea-turesthathandlesourcecodetointegrateeditorfunctionality.
ThisisnoticeableinthenewDiff(opened,forexample,byselectingasourcefileandchoosingSubversion>Diff).
Whenit'sshowingalocalfile,therightpaneiseditable,providingthefullsetofeditorfeatures–seman-tichighlightingandcodecompletionincluded.
ThenewDiffaddsotherinterestingtricks,likeone-clickmergingandword-leveldiff(ifasinglewordischangedinaline,onlythatwordishighlighted).
CheckouttheseimprovementsinFigure2.
YoucanalsoenableanInlineDifffeature,whichcreatesaDiffside-bar,highlightingupdatedsectionsofaversionedfile.
Thesidebarletsyouvisualizeorrollbackchanges,andopenthefullDiffview.
JavadochintsYoualwaysdocumentallyourcode,rightWell,ifyoudon't,Net-Beanswillcomplainaboutmissingandincorrectjavadoctags.
TheIDEcanhelpyouwithautomaticfixesthataddthemissingtags,onlyaskingyoutofillintheblanks.
Andwhileyou'redoingthat,youcanusethenewJavadocviewforconvenientpreviewing.
Javadoccheckingisactivebydefault,butit'snotintrusive:theedi-torwillreportmissingjavadoctagsjustfortheselectedline;onlyincorrecttagswillbereportedeverywhere.
YoucancustomizetheseandrelatedoptionsthroughTools|Options>JavaCode>Hints.
OtherfeaturesTheneweditoranditsframeworkincludeothergeneralfeatures,likereusableeditortabs.
Theseareusefulforthedebugger,toavoidclutteringyourenvi-ronmentwitheditorsopenedbybreakpointsorstep-into's.
There'salsoanewGenerateCodedialogthatautomatesthecreationofconstructors,gettersandsetters,equals()andhashCode(),anddelegatemethods.
RefactoringandJackpotNetBeans6.
0improvestheexistingrefac-toringsupportextensively.
Thereisanewinternallanguage-independentrefactoringAPIthatwillallowimplementingrefactoringsforcodeotherthancommon.
javasources(e.
g.
,XMLorJSFfiles).
ThenewAPIalsoallowsJavarefactoringstopreciselyupdatedependentnon-Javaelements.
Thisshouldmakethecurrentrefactoringssaferandeasiertouse.
Thebignewshere,though,isthebreak-throughnewtechnologyfromprojectJack-pot,whichhasbeenavailableforsometimebutisonlyreachingmaturitynow.
WithitsinclusioninNetBeans6.
0,JackpotwillbepromotedtoastandardfeatureandbemorecloselyintegratedwiththeIDE.
YoumayhaveheardthatJackpotisanewrefactoringtool,butthisreallydoesn'tmakeitjustice.
Jackpotisactu-allyacomprehensiveframeworkforgen-eralcodeunderstandingandmanipula-tion.
Youcanuseitasareplacementorfoundationforseveralkindsoffeatures:refactoringsupport,advancedsearchingandbrowsing,qualityinspection,macro-likeautomationofcomplexeditingtasks,andmore.
UsingJackpotBeforetakingamorein-depthlookatJack-pot,let'sshowhoweasyitistouse.
ThenewFigure2TheLocalHistoryandthenewDiff:editingcapability,semantichighlightingandword-leveldiff.
AIssueThreeNNetBeans6.
0:NewCoreFeaturesinDepth4A3AQueryandRefactorcommandwillshowadialoglikeFigure3,whereyoucanpickaJackpotqueryorqueryset.
Somequerieshaveoptionsthatyoucansettopreferredvalues.
ClickQuery,andanymatchesfortheselectedquerieswillappearinaviewthatdetailseachmatch.
Also,ifthequeryinvolvescodechanges,youcanpreviewandconfirmthesechangesbyclickingonaDoRefactoringbutton.
JackpotrulesJackpot'sfullpowercomesfromitsopen-ness.
ThisrequireslearninganewlanguagebutwhenyourealizeJackpot'sfullpotentialyouwillseethatthelearningcurvequicklypaysoff.
Forexample,hereisaJackpotquerythatdetectsaninefficientcodepattern–theuseofequals("")tocheckifaStringisempty–andrewritesthematchingcode:$s.
equals(s.
length()==0)::$sinstanceofjava.
lang.
String;Thesyntaxispattern=>replacement::condition,wherethe$characteridentifiesmeta-variablesthatwillbindtoanyJavaprogramelement(identifier,statement,operator,literal,etc.
).
Let'sanalyzeeachclause:1.
Thepattern$s.
equals("")matchesinvocationstotheequals()methodthatpassanemptystringasargument.
2.
TheconditionistheonlyoptionalpartofaruleinJackpot'srulelanguage,butit'sacriticalpartinthisparticularrule:$sinstanceofjava.
lang.
Stringmakessurethattheruleonlyfireswhen$sisaString.
That'sanimportantconstraint,sinceourruleisspe-cifictousesofjava.
lang.
String.
equals(),andnottojustanyimplementationofequals().
3.
Finally,thereplacement–($s.
length()==0)–re-writesthematchingcode.
There'salotofsophisticationbehindthisapparentlysimplebehavior.
Foronething,lookatJackpot'sinstanceofoperator.
ItwalksandquackslikeJava'sinstanceof,butit'snotthesamething.
Java'sinstanceofisaruntimeoperatorwhoseleft-handoperandisanobjectreference.
Jackpot'sinstanceof,however,isacom-pile-time(static)operator;itsleft-handoperandisanynodeoftheprogram'sAST.
BecauseJackpot–liketheneweditor–reliesonjavac'ssourceanalysisengine,it'sabletofullyattributealltypesintheprocessedcode.
Thisincludesthemostcomplexcases,likeinferredgenerictypes.
Othercodeanalysistoolsoftenresorttoheuristicsthatapproximatetypesbutmightfailtocalculatetypesforsomeex-pressions.
Youcouldeventrytodoourrefactoring(replacings.
equals("")bys.
length()==0)usingplainregularexpressions:searchfor(\w*)\.
equals\andreplaceitwith$1.
length()==0.
Butregexesarerigidanddumb;theywon'tEFigure3Jackpot'sQueryandRefactordialog.
AFigure4Jackpot'sRefactoringManager.
ACoreIDE10NNetBeansMagazineevenexcludetextthat'sinsidecommentsorstringliterals,andasimplelinebreakwillpreventdetection.
Thisisobviouslyastrawmanexample(othertools,likePMDandFindBugs,aremuchsmarterthanregexes–althoughnotuptojavac-likeprecision),butitshowsthevalueofsmartertools/features.
ThereareJackpotoperatorswithoutJavacounterparts,fromsimpleoneslikeisTrue(node),whichmatchesbooleanexpressionsthatcanstaticallybeproventoalwaysevaluatetotrue–tomorepowerfuloperatorslikeisSideEffectFree(node).
Thelattermatchesastatement,blockormethodthatdoesn'tmodifyanyvariableout-sideitsscope.
Again,suchdetectionsresembleexistingcodeinspectiontools,whichdetectproblemslike"deadcode".
ButJackpot'srelianceonthefulljavactechnologyresultsinfewerfalsepositivesindetec-tions,andhighersafetyinautomaticreplacements.
YoucanalsowriteJackpotqueriesinplainJava,usingJackpotAPIsandNetBeans'moduledevelopmentfeatures.
ThisisnecessaryforcomplexrulesthatgobeyondthecapabilitiesofJackpot'srulelanguage.
Butasthislanguageevolves,fewerandfewerqueriesshouldrequireimplementationinJava.
Performance,bytheway,isnotanissue:querieswrittenintheJackpotrulelanguageareconvertedtoJavaandexecuteascompiledcode.
Figure4showsJackpot'sRefactoringManager.
Thisconfigura-tiondialogallowsyoutoinspectallinstalledqueriesandorganizethemintoquerysets.
Youcanalsoimportnewqueries.
Ifyouwriteanewqueryscript,justclickImportandthenewquerywillbeavail-ableintheQueryandRefactordialog.
UsageandperspectivesJackpotshipswithalibraryofpredefinedqueries,containingmanyrulesforcodeclean-upanddetectionofcommonprogrammingmis-takesorcodeanti-patterns,aswellasmigrationofdeprecatedAPIusage.
AsIwritethis,JackpothasjustbeenintegratedintoNetBeans.
SowehaveahybridsystemwithJackpotco-existingwithtraditionalrefactoringandcodemanipulationfeatures.
Thismeansthatcom-mandslikeRenamemethodarestillimplementedintheold-fashionedway,eventhoughtheycouldbeimplementedbyaJackpotrule.
Thesameholdsforcodevalidations("hints")andtheirautomaticfixes.
Someofthisfunctionalitywillcertainlybere-E5AimplementedonJackpotinthefuture.
Also,becauseJackpotmakesthedevelopmentofsuchthingsmucheasier,youshouldexpectanincreasingnumberofrefactorings,vali-dationsandothercode-crunchingfeaturestobeaddedtotheIDE.
ExtendedAntandJUnitsupportAntsupportinNetBeans6.
0hasbeenup-datedtoAnt1.
7.
0,amajornewreleasethataddssuchfeaturesassupportforJSR223-compatiblescriptinglanguages.
There'salsoanewprogressindicatorforAntpro-cesses.
TheIDE'sJUnitsupportnowhandlestheannotation-driventestcasesofJUnit4.
OldJUnit3.
8testcasesarestillsupported.
Also,theprojectpropertieseditorisim-provedwithclasspathentriesspecifictounittests.
ProjectandbuildfeaturesEditingcodeisfundamental,butformostnon-trivialprojectsawell-structuredandpowerfulbuildsystemiscriticaltoo.
NetBeans'projectmanagementandbuildsystemwasimprovedwithmanynewfea-tures.
InadditiontoitsAntsupport,NetBeanscanopenandunderstandApacheMaven2projects.
ThoughthenewMaven-basedproj-Figure5MultipleConfigurationsandsupportforJavaWebStartinthenewProjectPropertiesdialog'sRunpage.
AIssueThreeN11NetBeans6.
0:NewCoreFeaturesinDepthectsupportisnotintendedtoreplaceAntprojectsanytimesoon,itwillbewelcometoMavenfansortoanybodyneedingtobuildaprojectthatrequiresMaven.
Also,nowyoucanspecifypackagesorclassestoexcludefromthesourcetree.
Thisisusefulforworkingwithlargeproj-ects,whenyou'renotinterestedinseeingorrunningalloftheircodeandapartialbuildisviable.
Ifyouhavemanycorrelatedprojects,youcanorganizethemintoProjectGroups,socertainoperationslikeopeningprojectscanbeappliedtothegroupasawhole.
AndifyouwriteJavaSEprojectswithmanyentrypoints(classeswithmain()methods),orwithcommand-lineparametersthatre-quirefrequenteditsoftheprojectproper-ties,theRunConfigurationsfeaturewillmakeyourlifeeasier.
Theprojectproper-ties'RunpageshowsanewConfigurationoption.
Eachconfigurationallowsyoutodefinethemainclass,argumentsandVMoptions,independentlyofotherconfigura-tions.
SeeanexampleinFigure5.
Furthermore,thenewJavaWebStartsup-portautomatesthecreationandmainte-nanceofJNLPfiles,andmakesiteasiertoruntestswithoutneedingabrowser.
IntheProjectProperties,checkApplication>WebStart>EnableWebStart,andoffyougo.
JavaWebStartsupportintegrateswiththeRunConfigurationsfeature,bycreatingaWebStartconfiguration.
SoyoucantestthesameprojectwithorwithoutJAWS.
VersioncontrolRobustversioncontrolisanessentialfea-ture,evenforsimpleprojectswrittenbyonedeveloperoveraweekend.
Foronething,it'scriticaltoenable"fearlessprogram-ming",e.
g.
usingtechniqueslikerefactoring(manualorautomatic)withoutworry.
NetBeans6.
0bringsplentyofnewsinthisareatoo.
CVSNetBeanshastraditionallysupportedtheCVSversioncontrolsys-temandthissupportwasalreadyexcellentinNetBeans5.
5.
Version6.
0addsseveralupdatesinusability,likeexportingadiffpatchoffilesselectedintheSearchview;anewcommandtoopenaspecificrevision,tagorbranch;andanimprovedhistorysearchfeaturewithnewSummaryandDiffviews.
Therearealsonewadvancedopera-tionslikechangingtheCVSrootanddoingapartialmerge.
SubversionThebiggestnewsformanyusers,though,issupportforthein-creasinglypopularSubversionversioncontrolsystem.
NetBeans6.
0isthefirstreleasetointegratecompletefirst-classsupportforSVN.
EventhoughNetBeans5.
5nowoffersaSubversionmoduleintheUpdateCenter,youreallywantversion6.
0ifyouareaheavySubversionuser.
LocalHistoryNomatterwhichVersionControlSystemyouprefer,you'lllovethenewLocalHistoryfeature,alreadydepictedinFigure2.
NetBeans6.
0automaticallykeepsaninternalhistoryofrecentchangestoprojectresources.
Everytimeyousaveafile,thisisregisteredasa"commit"ofanewversionofthefileinthelocalhistory.
Sofilechangesaretrackedwithfinegranularity–somewhatlikeapersis-tentundofeature.
Youcaninspectthe"versions"inthelocalhistoryanddiffthemagainstthecurrentfiles.
Bewarned,however,thatthisfeatureismostlyusefulforundoingmistakesthatescapetheeditor'sundocapacity,e.
g.
afterclosingtheeditororrestartingtheIDE.
Youcanthenreverttoapreviousstatethatyouhaven'tyetcommittedtoasaferVCSrepository,per-hapsbecausethenewcodewasstillroughanduntested.
TheLocalHistoryfeatureispowerfulandissometimesalifesaver,butit'snotafullreplacementforarealVCS.
DebuggingThedebuggerisofcourseamongthemostcriticalfeaturesofanIDE,andNetBeansisalreadyverycompleteinthisarea.
Sowhat'slefttoimprovein6.
0Firstoff,theJavaSE6releasecontainstwonbi.
netbeans.
orgThenewNetBeansInstaller.
Asofthiswriting,youmustfollowalinktoadirectorywhereyou'llnavigatetotheinstallerpageforaspecificbuildCoreIDE12NNetBeansMagazineimportantnewJVMdebuggingfeatureswhichrequireanupdatedde-buggertouse.
(ThedebuggersfromNetBeans5.
5orolderreleaseswon'tbenefitfromtheseevenifyourunthemontopofJavaSE6.
)TherearealsootherdebuggerimprovementsthatarenotdependentontheJREversion,soyou'llbenefitevenifyouarechainedtosomestone-ageJavaruntimelike5.
0or,heavensforbid,1.
4.
2.
ForcingreturnvaluesSupposeyou'resteppinganywhereinamethodandyou'dliketoforceittoreturnimmediatelyandproduceaspecificreturnvalue.
Thisisnowsupportedinthe6.
0debugger,lettingyoucheck"what-if"scenariosandreproducebugsmoreeasily.
Youwon'tneedhackslikepatchingthesourcecodewithreturnstatements(andhavingtounpatchitlater).
AsIwrite,thisfeatureisnotyetimplemented,butitshouldbebeforethefinalrelease.
ExpressionsteppingExpressionsteppingisanothersmarttimesaver.
Incomplexexpres-sionscontainingmethodcalls,youcanstepintoindividualinvoca-tions,andwhensuchacallreturnsyoucanseethereturnedvalueevenit'snotassignedtoanylocalvariable.
Younolongerhavetobreakexpressionsintosimplepartsandintroducetemporarylocalsforthesinglepurposeofhelpingdebugging.
Also,theLocalVariablesviewwillshowthevaluereturnedbyinvokedmethods.
ExpressionsteppingwillworkinanyJavaruntime,butshowingval-uesreturnedbyinvokedmethodsrequiresJavaSE6.
MultithreadingsupportAnothernewfeaturethat'sveryusefulisDebugcurrentthread:youcaninstructthedebuggersothatonlyagiventhreadwillstopinbreakpoints.
Thisiscrucialfordebuggingconcurrentapplicationsthathaveseveralthreadsrunningthecodeofinterest.
Sincewedevelopersarenotmultithreaded,we'reeas-ilyoverwhelmedwhensettingabreakpointcausesthedebuggertostoptwentythreadsatonce!
OtherfeaturesTherearealsogeneralimprovementstootherfeatures,likebetterhandlingofbrokenbreakpoints(e.
g.
withincor-rectconditions),andacommandtocopycallstackstotheclipboard.
6ANewProfilerfeaturesInNetBeans6.
0,theProfilerbecomespartofthecoredistribution,andthere'sarangeofimportantimprovements.
Betterperformance–Performanceisgoodanywherebutit'salwaysacriticalis-sueinprofilers.
TheNetBeansProfiler,whichderivesfromSun'sJFluidresearchproject,pioneeredanewtechnologythatallowspro-filingappsnearlyatfullspeedbydynami-callyinstrumentingcode.
Also,theProfileritselfshouldbefasttoanalyzeandpresentdatacollectedfromtheJVM–especiallyonlinedatathat'sconstantlyupdatedastheprogramruns.
ThenewreleaseimprovessignificantlytheperformanceoftheLiveRe-sultscategorizationanddrilldown,soyou'llfindyourselfusingthisfeaturemoreoften.
Classloadingtelemetry–TheVMTe-lemetryviewnowshowsthenumberofloadedclassestogetherwiththenumberofthreads.
Memorysnapshotcomparison–Yourapplicationhasamethodthat'ssuspectofleakingTakeheapsnapshotsbeforeandaf-terrunningitthendiffthetwosnapshots.
HeapWalker–Theultimatetoolforleakhuntingandanykindofmemoryallocationanalysis.
Youcanloadaheapdumpandvi-sualizethefullobjectgraphintheheap(seeFigure6).
Figure6TheProfiler'sHeapWalker,inspectingaparticularinstanceofBigInteger.
AIssueThreeN13NetBeans6.
0:NewCoreFeaturesinDepth2Incidentally,severalmenuoptionsweresim-plifiedinNetBeans6.
0;forinstance,JavaPlat-formManagerbecameJavaPlatforms.
Loadgeneration–TheProfilersupportsintegrationwithloadgenerationtools(cur-rentlyonlyApacheJMeterissupportedbutmoreistocome).
ProfilingPoints–Theseareaprofiler'sequivalentofdebuggerbreakpoints.
Youcandefineplacesinyoursourcecodewheretheprofilershouldstart/stoptheclock,resetprofilingresultsortakeasnap-shot.
TheProfilingPointsfeatureremovesmostbureaucraticprofilingwork:neveragainwillyouneedtosteporpausecodetogetsnapshotsincriticalevents;youalsowon'tneedtotweakcodetomeasurethelatencyofaregionthatdoesn'tcoincidewithafullmethod.
GUIandusabilityAnIDEshouldhaveabeautiful,efficientandproductiveGUIasmuchasanyotherapplication.
NetBeans6.
0makesnewstridesinthisdirection.
LinuxandSolarisuserswillcertainlywel-comethemuchimprovedGTKL&F,whichisnowactivatedbydefaultontheseplat-forms.
Theactivated-by-defaultpartde-pendsonSun'sJRE6Update1(orbetter),whichcontainsitsownshareofimportantGTKupdates.
NetBeanswillrespectallsettingsfromtheactiveGTKtheme.
ThenewNetBeansInstaller(NBI)makesinstallationeasierandfaster.
Inthedown-loadspage,youcanselectwhichpacksyouwant(e.
g.
Enterprise,Mobility).
Thenyou'llbeofferedacustominstallerthatincludesallchosenfeaturesandwillin-stalltheseinasinglego.
NBIisespeciallyconvenientforsystemadministratorsthatneedtoinstallthesameIDEconfigurationinmultiplemachines,andfortrainerswhooftenlandinunpreparedlaboratories.
NetBeansalsoincludesredesignedicons,andtheSDIwindow-ingoption(arelicfromancientNetBeansreleases)wasremoved.
Nowyouhaveundockable/floatingwindows.
Finally,intheQAfront,thenewReportExceptiontoolstreamlinesreportingofdetaileder-rordatatoNetBeans'developers,whiletheUIGesturesCollectorcansubmitdataaboutyourIDEusagepatterns.
Thisdataisusefulnotonlyforresearch,butalsotoimplementakindof"tipoftheday"hintsystemnotbasedonMath.
random().
Itestedthis,andtheNetBeansAnalyticssiteofferedmeatutorialaboutprofilingmultithreadedprograms,whichwashighlycorrelatedwiththetasksIhadbeenperforminginrecentdays.
MatisseandvisualwebdevelopmentThereareonlytwocoreIDEfeaturesI'mnotcoveringhere.
Bothareaward-winningtoolsandtopreasonsformanydevelopershav-ingmovedtoNetBeans:theMatissevisualeditor,andtheVisualWebPack.
NetBeans6.
0bringssignificantupdatestoboth.
ForMatisse,checkoutthearticle"UIDesigninNetBeans6.
0"inthisissue,whereyou'llfinddetailedinformationaboutwhat'snew.
Currently,themostimportantchangesintheVisualWebPackrefertoitsintegrationintotheNetBeanscore.
Actually,therewon'tbeanexternalWebPackfor6.
0.
TheIDEalreadyofferedsupportforwebapplicationdevelopment,soitwasalittleoddtohavesomeofthatinthecoreandtherestinanexternalPack.
Historically,thishappenedbecausetheWebPacktechnologywasoriginallydevel-opedasaseparateproduct(Sun'sJavaStudioCreator),whichwasbasedonaforkofaveryoldNetBeansversion.
Soitsimplementa-tionbecamepartiallyredundantwithNetBeans'webtooling.
Nowthischasmisclosedandtherewillbenomoreduplicatecodeoreffort.
ThemergeresultsinasimplerIDEforallusers:fromvisual-designloverstotag-writingdiehards.
Thereareseveralnewfeaturesintheintegratedwebtoolingbutaswewritetheyarestillunderheavydevelopment,soitwasn'tviabletocoverthenewfunctionalityinthisissue.
However,don'tmissthearticle"VisualWebApplicationDesignwithNetBeans"foranupdatedtutorialonthelaststableversion.
PluginManagerNetBeans'open,extensiblearchitectureisoneofitscoreadvan-tagesandit'salsoveryeasytouseandintegratewith.
YoumaybesurprisedthattheTools>UpdateManagerhasdisappeared,though.
CoreIDE14NNetBeansMagazine7AButjustlookagain,atTools>Plugins2,andyou'llseeFigure7.
ThenewUIunifiesandbetterorganizestheoldUpdateCenter(seetheUpdates,NewPlugins,DownloadedandSettingstabs),andalsotheoldmodulemanager(seetheInstalledtab).
Therearenewfea-turestoo:forexample,whenyouselectaplugin(likewedidfortheJMeterModuleinFigure7),aRequiredPluginsnodewillappearifapplicable;youcanexpandittoseeanydependenciesthatmustalsobeinstalled.
ConclusionsNetBeans6.
0comeswithamassivenumberofnewandimprovedfeaturesandcertainlydeservesthemajorversionbump.
IfNetBeans5.
5waswide,NetBeans6.
0isalsodeep.
Developersupgradingtothelat-estversionwillhavenotonlyextensivesupportforallkindsofJavadevelop-mentbutalsoabest-of-breedfeaturesetineveryimportantfunctionalityarea.
ManyNetBeanspowerusersmayhavegonethroughthisarticleandfoundfea-turesthatwerealreadyavailableforpre-viousversionsviaadditionalmodules.
FromseveraleditorenhancementstoRunConfigurations,totheLocalHistory,youcouldfindannbmfilethatwouldprovidesomelevelofsupportforyourneed.
However,youcannowjustinstallthecoreIDEandhaveallthesefeaturesoutofthebox–andthey'resuperior,morepolishedandbetterintegratedthanwhat'sprovidedthroughexternalmodules.
Thishappensofcoursewitheverynewrelease,butNetBeans6.
0makesaverynoticeableefforttocatchupwithitsRFEs,embracingalargenumberofimprovementsthatfirstsurfacedascontributionsfromthebroadercommunity.
Thiscanonlybeviewedasgreatnews,andasevidenceofaprojectthatmovesfastinthedirectionus-erswant.
COsvaldoPinaliDoederlein(opinali@gmail.
com)isasoftwareengineerandconsultant,workingwithJavasince1.
0beta.
He'sanindependentexpertfortheJCP,havingservedforJSR-175(JavaSE5),andisaTechnologyArchitectatVisionnaireInformatica.
OsvaldohasanMScinObjectOrientedSoftwareEngineering,isacontributingeditorforJavaMagazineandmaintainsablogatweblogs.
java.
net/blog/opinali.
Figure7ThenewPluginManager.
ACoreIDEWiththisthirdissue,NetBeansMagazineiscompletingitsfirstanniversary.
KudosandthankstotheNetBeansdevelopercommunityforenablingustospreadthewordevenmoreaboutthiswonderfulIDEandPlatform!
1Yearnetbeans.
org/community/magazinemagazineCoreNetBeans6.
0FeaturesKnowindepthwhat'scominginthenewreleaseIntroducingC/C++PackLeverageNetBeansfornativedevelopmentTheblueMarineProjectNetBeansPlatformdevelopmentintherealworldOpenOffice.
orgIntegrationCreateadd-onsandcomponentstointerfacewithOOoProjectSchliemannOpeningtheIDEtootherlanguagesMobilityPackinPracticeLearnthebasicsandreducedevicefragmentationNewUIDesignFeaturesUpgradeyourdesktopproductivitywithNetBeans6.
0VisualWebDevelopmentRapidwebapplicationdesignandimplementationMay.
2007Release6.
0.
JSF.
Matisse.
C/C++.
Mobility.
NetBeansPlatform.
ScriptingLanguagesmagazineReachOutwiththeIDEandPlatform
极光KVM怎么样?极光KVM本月主打产品:美西CN2双向,1H1G100M,189/年!在美西CN2资源“一兆难求”的大环境下,CN2+大带宽 是很多用户的福音,也是商家实力的象征。目前,极光KVM在7月份的促销,7月促销,美国CN2 GIA大带宽vps,洛杉矶联通cuvip,14元/月起;香港CN2+BGP仅19元/月起,这次补货,机会,不要错过了。点击进入:极光KVM官方网站地址极光KVM七月...
易探云服务器怎么过户/转让?易探云支持云服务器PUSH功能,该功能可将云服务器过户给指定用户。可带价PUSH,收到PUSH请求的用户在接收云服务器的同时,系统会扣除接收方的款项,同时扣除相关手续费,然后将款项打到发送方的账户下。易探云“PUSH服务器”的这一功能,可以让用户将闲置云服务器转让给更多需要购买的用户!易探云服务器怎么过户/PUSH?1.PUSH双方必须为认证用户:2.买家未接收前,卖家...
官方网站:点击访问创梦网络宿迁BGP高防活动方案:机房CPU内存硬盘带宽IP防护流量原价活动价开通方式宿迁BGP4vCPU4G40G+50G20Mbps1个100G不限流量299元/月 209.3元/月点击自助购买成都电信优化线路8vCPU8G40G+50G20Mbps1个100G不限流量399元/月 279.3元/月点击自助购买成都电信优化线路8vCPU16G40G+50G2...
highlighter为你推荐
太康县公安局网警取证塔采购项目湖北省网易yeahlinux防火墙设置如何在Linux中启动/停止和启用/禁用FirewallD和Iptables防火墙重庆电信断网这几天为什么重庆电信的网络总是这么不稳定flashfxp注册码谁有~FLASHfxp V3.0.2的注册码~~谢谢哦!!要现在能用的!!!!支持http河南省全民健康信息平台建设指引(试行)团购程序有什么好用的社区团购小程序?联系我们代码如何查询统一社会信用代码无忧登陆无忧登陆怎么用??
vps虚拟主机 m3型虚拟主机 google镜像 星星海 国外idc 私人服务器 10t等于多少g 42u标准机柜尺寸 淘宝双十一2018 512m内存 java空间 好看qq空间 40g硬盘 web服务器架设 腾讯云分析 大容量存储器 帽子云 789电视网 域名和空间 稳定免费空间 更多